Skip to content

Commit

Permalink
test(Channels): Update mail channel configuration
Browse files Browse the repository at this point in the history
- Updated configuration for the mail channel in MailChannelTest.php and NotifyChannelTest.php
- Removed unnecessary extender setting
- Updated exception class references to use InvalidArgumentException directly
  • Loading branch information
guanguans committed May 11, 2024
1 parent 002920c commit d85eaf4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions tests/Channels/MailChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
*/

use Guanguans\LaravelExceptionNotify\ExceptionNotifyManager;
use Guanguans\LaravelExceptionNotify\Exceptions\InvalidArgumentException;
use Guanguans\LaravelExceptionNotify\Mail\ReportExceptionMail;
use Illuminate\Support\Facades\Mail;

it('will throw `InvalidArgumentException`', function (): void {
config()->set('exception-notify.channels.mail.extender', null);

config()->set('exception-notify.channels.mail.extender');
$this->app->make(ExceptionNotifyManager::class)->driver('mail');
})->group(__DIR__, __FILE__)->throws(\Guanguans\LaravelExceptionNotify\Exceptions\InvalidArgumentException::class);
})->group(__DIR__, __FILE__)->throws(InvalidArgumentException::class);

it('will throw `TransportException`', function (): void {
config()->set(
Expand Down
3 changes: 2 additions & 1 deletion tests/Channels/NotifyChannelTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

use Guanguans\LaravelExceptionNotify\Channels\NotifyChannel;
use Guanguans\LaravelExceptionNotify\ExceptionNotifyManager;
use Guanguans\LaravelExceptionNotify\Exceptions\InvalidArgumentException;
use Illuminate\Config\Repository;
use Psr\Http\Message\ResponseInterface;

Expand All @@ -25,7 +26,7 @@
'extender' => null,
],
]));
})->group(__DIR__, __FILE__)->throws(\Guanguans\LaravelExceptionNotify\Exceptions\InvalidArgumentException::class);
})->group(__DIR__, __FILE__)->throws(InvalidArgumentException::class);

it('can report', function (): void {
expect(app(ExceptionNotifyManager::class)->driver('bark'))
Expand Down
2 changes: 0 additions & 2 deletions tests/Pest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
* @see https://github.com/guanguans/laravel-exception-notify
*/

namespace Tests;

use Guanguans\LaravelExceptionNotify\ExceptionNotifyManager;
use Guanguans\LaravelExceptionNotify\Tests\TestCase;

Expand Down
3 changes: 2 additions & 1 deletion tests/Pipes/PipeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Guanguans\LaravelExceptionNotify\CollectorManager;
use Guanguans\LaravelExceptionNotify\Contracts\Collector;
use Guanguans\LaravelExceptionNotify\Contracts\ExceptionAware;
use Guanguans\LaravelExceptionNotify\Exceptions\RuntimeException;
use Guanguans\LaravelExceptionNotify\Pipes\FixPrettyJsonPipe;
use Illuminate\Pipeline\Pipeline;
use Illuminate\Support\Collection;
Expand All @@ -28,7 +29,7 @@
collect(app(CollectorManager::class))
->transform(static function (Collector $collector): Collector {
if ($collector instanceof ExceptionAware) {
$collector->setException(new \Guanguans\LaravelExceptionNotify\Exceptions\RuntimeException);
$collector->setException(new RuntimeException);
}

return $collector;
Expand Down
3 changes: 2 additions & 1 deletion tests/Support/ExceptionContextTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@
* @see https://github.com/guanguans/laravel-exception-notify
*/

use Guanguans\LaravelExceptionNotify\Exceptions\RuntimeException;
use Guanguans\LaravelExceptionNotify\Support\ExceptionContext;

it('can get marked exception context', function (): void {
expect(ExceptionContext::getMarked(new \Guanguans\LaravelExceptionNotify\Exceptions\RuntimeException))->toBeArray();
expect(ExceptionContext::getMarked(new RuntimeException))->toBeArray();

try {
eval('throw new Exception("eval");');
Expand Down

0 comments on commit d85eaf4

Please sign in to comment.