diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml index c99e1fc..b9b18d9 100644 --- a/.github/workflows/php-cs-fixer.yml +++ b/.github/workflows/php-cs-fixer.yml @@ -13,9 +13,9 @@ jobs: ref: ${{ github.head_ref }} - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga:2.18.6 + uses: docker://oskarstark/php-cs-fixer-ga with: - args: --config=.php_cs --allow-risky=yes + args: --config=.php_cs.dist.php --allow-risky=yes - name: Commit changes uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..3c8743a --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,26 @@ +name: PHPStan + +on: + push: + paths: + - '**.php' + - 'phpstan.neon.dist' + +jobs: + phpstan: + name: phpstan + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + coverage: none + + - name: Install composer dependencies + uses: ramsey/composer-install@v1 + + - name: Run PHPStan + run: ./vendor/bin/phpstan --error-format=github \ No newline at end of file diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 5a0f874..afde7a3 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,12 +9,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: [7.4, 8.0, 8.1] - laravel: [8.*] + php: [8.0, 8.1] + laravel: [9.*] dependency-version: [prefer-stable] include: - - laravel: 8.* - testbench: 6.* + - laravel: 9.* + testbench: 7.* name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 132662b..f4825fc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,8 @@ composer.phar composer.lock .php_cs.cache -.phpunit.result.cache .DS_Store /.idea -/.vscode \ No newline at end of file +/.vscode +.phpunit.result.cache +.php-cs-fixer.cache \ No newline at end of file diff --git a/.php_cs b/.php_cs deleted file mode 100644 index 88fca70..0000000 --- a/.php_cs +++ /dev/null @@ -1,145 +0,0 @@ -exclude([ - 'node_modules', - 'vendor', - 'storage', - 'bootstrap', - 'public', - 'resources/lang' - ]) - ->in(__DIR__); - - return PhpCsFixer\Config::create() - ->setRiskyAllowed(true) - ->setRules([ - '@PSR2' => true, - 'align_multiline_comment' => [ - 'comment_type' => 'phpdocs_only', - ], - 'array_syntax' => [ - 'syntax' => 'short', - ], - 'binary_operator_spaces' => [ - 'default' => 'single_space', - ], - 'blank_line_after_namespace' => true, - 'blank_line_after_opening_tag' => true, - 'blank_line_before_statement' => [ - 'statements' => [ - 'return', - 'throw', - 'try', - ], - ], - 'braces' => [ - 'allow_single_line_closure' => true - ], - 'cast_spaces' => true, - 'class_definition' => true, - 'concat_space' => [ - 'spacing' => 'none', - ], - 'declare_equal_normalize' => true, - 'elseif' => true, - 'encoding' => true, - 'full_opening_tag' => true, - 'function_declaration' => true, - 'function_typehint_space' => true, - 'general_phpdoc_annotation_remove' => [ - 'access', - 'package', - 'subpackage', - ], - 'hash_to_slash_comment' => true, - // 'heredoc_to_nowdoc' => true, - 'include' => true, - 'indentation_type' => true, - 'line_ending' => true, - 'lowercase_cast' => true, - 'lowercase_constants' => true, - 'lowercase_keywords' => true, - 'magic_constant_casing' => true, - 'method_argument_space' => true, - 'method_separation' => true, - 'native_function_casing' => true, - 'new_with_braces' => true, - 'no_blank_lines_after_class_opening' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_closing_tag' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_consecutive_blank_lines' => [ - 'throw', - 'use', - 'useTrait', - 'extra', - ], - 'no_leading_import_slash' => true, - 'no_leading_namespace_whitespace' => true, - 'no_mixed_echo_print' => [ - 'use' => 'echo', - ], - 'no_multiline_whitespace_around_double_arrow' => true, - 'no_multiline_whitespace_before_semicolons' => true, - 'no_short_bool_cast' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_spaces_after_function_name' => true, - 'no_spaces_around_offset' => [ - 'inside', - 'outside', - ], - 'no_spaces_inside_parenthesis' => true, - 'no_trailing_comma_in_list_call' => true, - 'no_trailing_comma_in_singleline_array' => true, - 'no_trailing_whitespace' => true, - 'no_trailing_whitespace_in_comment' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unused_imports' => true, - 'no_useless_return' => true, - 'no_whitespace_before_comma_in_array' => true, - 'no_whitespace_in_blank_line' => true, - 'normalize_index_brace' => true, - 'object_operator_without_whitespace' => true, - 'ordered_imports' => [ - 'sortAlgorithm' => 'alpha', - ], - 'phpdoc_align' => true, - 'phpdoc_indent' => true, - 'phpdoc_inline_tag' => true, - 'phpdoc_no_alias_tag' => [ - 'type' => 'var', - ], - 'phpdoc_no_useless_inheritdoc' => true, - 'phpdoc_order' => true, - 'phpdoc_scalar' => true, - 'phpdoc_separation' => true, - 'phpdoc_single_line_var_spacing' => true, - 'phpdoc_summary' => true, - 'phpdoc_to_comment' => true, - 'phpdoc_trim' => true, - 'phpdoc_types' => false, - 'phpdoc_var_without_name' => true, - 'self_accessor' => true, - 'short_scalar_cast' => true, - 'single_blank_line_at_eof' => true, - 'single_blank_line_before_namespace' => true, - 'single_class_element_per_statement' => true, - 'single_import_per_statement' => true, - 'single_line_after_imports' => true, - 'single_quote' => true, - 'space_after_semicolon' => true, - 'standardize_not_equals' => true, - 'switch_case_semicolon_to_colon' => true, - 'switch_case_space' => true, - 'ternary_operator_spaces' => true, - 'trailing_comma_in_multiline_array' => false, - 'trim_array_spaces' => true, - 'unary_operator_spaces' => true, - 'visibility_required' => [ - 'method', - 'property', - ] - ]) - ->setFinder($finder); diff --git a/.php_cs.dist.php b/.php_cs.dist.php new file mode 100644 index 0000000..0a4a56d --- /dev/null +++ b/.php_cs.dist.php @@ -0,0 +1,39 @@ +in([ + __DIR__.'/src', + ]) + ->name('*.php') + ->notName('*.blade.php') + ->ignoreDotFiles(true) + ->ignoreVCS(true); + +return (new PhpCsFixer\Config()) + ->setRules([ + '@PSR12' => true, + 'array_syntax' => ['syntax' => 'short'], + 'ordered_imports' => ['sort_algorithm' => 'alpha'], + 'no_unused_imports' => true, + 'not_operator_with_successor_space' => true, + 'trailing_comma_in_multiline' => true, + 'phpdoc_scalar' => true, + 'unary_operator_spaces' => true, + 'binary_operator_spaces' => true, + 'blank_line_before_statement' => [ + 'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'], + ], + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_var_without_name' => true, + 'class_attributes_separation' => [ + 'elements' => [ + 'method' => 'one', + ], + ], + 'method_argument_space' => [ + 'on_multiline' => 'ensure_fully_multiline', + 'keep_multiple_spaces_after_comma' => true, + ], + 'single_trait_insert_per_statement' => true, + ]) + ->setFinder($finder); diff --git a/CHANGELOG.md b/CHANGELOG.md index 053d5da..45c7db9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to `laravel-mailviewer` will be documented in this file. +## 3.0 - 2022-02-07 + +- Laravel 9 support (Symfony Mailer) + +## 2.0 - 2021-12-22 + +- N/A + ## 1.0 - 2020-12-22 - Initial release diff --git a/README.md b/README.md index 6531dae..99cd4cc 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ [![Total Downloads](https://img.shields.io/packagist/dt/label84/laravel-mailviewer.svg?style=flat-square)](https://packagist.org/packages/label84/laravel-mailviewer) ![GitHub Workflow Status](https://img.shields.io/github/workflow/status/label84/laravel-mailviewer/run-tests?label=Tests&style=flat-square) -Laravel MailViewer enables you to view and filter mail that is sent by your Laravel application. It saves all sent mail to the database automatically. It also includes an overview page with the total number of mails sent grouped by Notification. +With ``laravel-mailviewer`` you can view and filter mail that is sent by your Laravel application in the browser. The package saves all mails sent to the database automatically. +You can get get an overview of all mails sent, view individual mails and get an overview of the number of mails sent grouped by Notification. ![MailViewer screenshot](./docs/screenshot_default.png?raw=true "MailViewer Screenshot") @@ -14,30 +15,31 @@ Laravel MailViewer enables you to view and filter mail that is sent by your Lara - [Laravel support](#laravel-support) - [Installation](#installation) - [Usage](#usage) - - [Query filters](#query-filters) + - [Filters](#Filters) - [Analytics](#analytics) - [Examples](#examples) - [Commands](#commands) - [Exclude records](#exclude-records) - [Tests](#tests) -- [Security](#security) - [License](#license) ## Requirements -- Laravel 7.x or 8.x +- Laravel 8.x or 9.x - PHP >=7.4 or 8.x ## Laravel support | Version | Release | |---------|---------| +| 9.x | ^3.0 | | 8.x | ^2.0 | -| 7.x | ^1.0 | ## Limitations -This package is only able to track mails send via [SwiftMailer library](https://swiftmailer.symfony.com). By default Laravel uses this library when sending mails via [Mailables](https://laravel.com/docs/8.x/mail) and [Notifications](https://laravel.com/docs/8.x/notifications). +This package tracks mails sent via [Symfony Mailer](https://symfony.com/doc/current/mailer). Laravel 9 uses this library by default when sending mails via [Mailables](https://laravel.com/docs/master/mail) and [Notifications](https://laravel.com/docs/master/notifications). + +With the upgrade to Laravel 9 the SwiftMailer has been replaced with Symfony Mailer [Upgrade Symfony Mailer](https://laravel.com/docs/master/upgrade#symfony-mailer). To add this package to a Laravel 8 application you have to use version ``^2.0`` of this package - ``composer require "label84/laravel-mailviewer:^2.0"``. ## Installation @@ -49,26 +51,14 @@ Add the package to your application: composer require label84/laravel-mailviewer ``` -You can also manually update your composer.json. - -### 2. Install package - -Add the config and migration to your application. - -```sh -php artisan mailviewer:install -``` - -#### 2.1 Install package manually (alternative) - -You can also install the package manually by executing the following two commands. +### 2. Publish the config file and migration ```sh php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="config" php artisan vendor:publish --provider="Label84\MailViewer\MailViewerServiceProvider" --tag="migrations" ``` -#### 2.2 Publish the views (optional) +#### 2.1 Publish the views (optional) To change the default views, you can publish them to your application. @@ -86,13 +76,9 @@ php artisan migrate ## Usage -To preview the mails sent by your application visit: ``/admin/mailviewer`` - -You can change the url in the config file. +To preview the mails sent by your application visit: ``/admin/mailviewer``. You can change this url in the config file. -To view the content of the mail you can click on the UUID (blue link). - -### Query filters +### Filters You can filter the mails in the overview with query parameters - example ``/admin/mailviewer?notification=WelcomeMail``. @@ -114,9 +100,9 @@ The around parameter show all mails sent around the given time. By default is wi ![MailViewer Analytics screenshot](./docs/screenshot_analytics.png?raw=true "MailViewer Analytics Screenshot") -To preview the analytics page visit: ``/admin/mailviewer/analytics`` +To preview the analytics page visit: ``/admin/mailviewer/analytics``. You can change this url in the config file. -You can change the route in the config file. +On the analytics page you can view the number of mails sent per Notification and see how long ago the latest Notification was sent. ### Examples @@ -142,7 +128,7 @@ php artisan mailviewer:cleanup --days=30 ### Exclude records -In the config file you can add an array of notification classes and an array of email addresses that should be excluded. Those notifications and email addresses won't be saved to the database. +In the config file you can add an array of Notification classes and an array of email addresses that should be excluded. Those notifications and email addresses won't be saved to the database. ## Tests @@ -151,10 +137,6 @@ composer analyse composer test ``` -## Security - -By default the package only applies the 'web and 'auth' middleware to the routes. When used in production make sure you apply additional middleware or other security measures to restrict access. - ## License [MIT](https://opensource.org/licenses/MIT) diff --git a/composer.json b/composer.json index 4ab71f5..9c5c231 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "label84/laravel-mailviewer", - "description": "A mail viewer package.", + "description": "View mails sent by Laravel in the browser", "type": "library", "license": "MIT", "authors": [ @@ -10,14 +10,14 @@ } ], "require": { - "php": "^7.4 || ^8.0", - "illuminate/auth": "^8.0", - "illuminate/routing": "^8.0", - "illuminate/support": "^8.0", - "illuminate/database": "^8.0" + "php": "^8.0", + "illuminate/auth": "^9.0", + "illuminate/routing": "^9.0", + "illuminate/support": "^9.0", + "illuminate/database": "^9.0" }, "require-dev": { - "orchestra/testbench": "^6.0", + "orchestra/testbench": "^7.0", "nunomaduro/larastan": "^1.0", "phpunit/phpunit": "^9.5" }, diff --git a/config/mailviewer.php b/config/mailviewer.php index 33806b7..0543aaa 100644 --- a/config/mailviewer.php +++ b/config/mailviewer.php @@ -20,7 +20,7 @@ */ 'route' => [ 'prefix' => 'admin/mailviewer', - 'middleware' => ['web', 'auth'], + 'middleware' => ['web'], ], /* diff --git a/phpstan.neon.dist b/phpstan.neon.dist index 261285f..fe03069 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -9,18 +9,21 @@ parameters: - routes - config - # The level 8 is the highest level + # The level 9 is the highest level level: 8 ignoreErrors: - message: '#Parameter [a-zA-Z0-9\\_]+ $time of static method Carbon\Carbon::parse() expects DateTimeInterface|string|null, array|string|null given.#' path: src/Http/Controllers/MailViewerController.php - - - message: '#Cannot call method getFieldBody\(\) on Swift_Mime_Header\|null.#' - path: src\Listeners\CreateMailViewerItem.php + - + message: '#Unable to resolve the template type TKey in call to function collect#' + path: src/Models/MailViewerItem.php + - + message: '#Unable to resolve the template type TValue in call to function collect#' + path: src/Models/MailViewerItem.php - excludes_analyse: + excludePaths: checkMissingIterableValueType: false \ No newline at end of file diff --git a/src/Console/Commands/InstallMailViewer.php b/src/Console/Commands/InstallMailViewer.php deleted file mode 100644 index 73d08ab..0000000 --- a/src/Console/Commands/InstallMailViewer.php +++ /dev/null @@ -1,31 +0,0 @@ -info('Installing mail viewer package...'); - - $this->call('vendor:publish', [ - '--provider' => "Label84\MailViewer\MailViewerServiceProvider", - '--tag' => 'config' - ]); - - $this->call('vendor:publish', [ - '--provider' => "Label84\MailViewer\MailViewerServiceProvider", - '--tag' => 'migrations' - ]); - - $this->info('All done!'); - } -} diff --git a/src/Http/Controllers/MailViewerController.php b/src/Http/Controllers/MailViewerController.php index 87cf8eb..fcca44b 100644 --- a/src/Http/Controllers/MailViewerController.php +++ b/src/Http/Controllers/MailViewerController.php @@ -52,7 +52,7 @@ public function analytics(): View DB::raw('MAX(sent_at) AS last_sent_at'), ]) ->groupBy('notification') - ->orderBy('total', 'DESC') + ->orderByDesc('total') ->get(); return view('mailviewer::analytics', compact('items')); diff --git a/src/Listeners/CreateMailViewerItem.php b/src/Listeners/CreateMailViewerItem.php index 6e9161d..d34f43f 100644 --- a/src/Listeners/CreateMailViewerItem.php +++ b/src/Listeners/CreateMailViewerItem.php @@ -3,68 +3,72 @@ namespace Label84\MailViewer\Listeners; use Illuminate\Mail\Events\MessageSent; +use Illuminate\Support\Collection; use Label84\MailViewer\Models\MailViewerItem; -use Swift_Message; -use Swift_Mime_SimpleHeaderSet; +use Symfony\Component\Mime\Email; +use Symfony\Component\Mime\Header\Headers; class CreateMailViewerItem { public function handle(MessageSent $event): void { - if (!$this->shouldLog($event)) { + if (! $this->shouldLog($event)) { return; } + /** @var \Symfony\Component\Mime\Email $message */ + $message = $event->message; + MailViewerItem::create([ 'event_type' => MessageSent::class, 'mailer' => config('mail.default') ?? '', - 'headers' => $this->formatHeaders($event->message->getHeaders()), + 'headers' => $this->formatHeaders($message->getHeaders()), 'notification' => $event->data['__laravel_notification'] ?? null, - 'recipients' => $this->formatRecipients($event->message), - 'subject' => $event->message->getSubject(), - 'body' => $event->message->getBody(), + 'recipients' => $this->formatRecipients($message), + 'subject' => $message->getSubject(), + 'body' => $message->getHtmlBody(), 'sent_at' => now(), ]); } - private function formatHeaders(Swift_Mime_SimpleHeaderSet $header): array + private function formatHeaders(Headers $headers): array { - if (!config('mailviewer.database.include.headers')) { + if (! config('mailviewer.database.include.headers')) { return []; } return [ - 'content-type' => $header->get('content-type')->getFieldBody(), - 'mime-version' => $header->get('mime-version')->getFieldBody(), - 'date' => $header->get('date')->getFieldBody(), - 'message-id' => $header->get('message-id')->getFieldBody(), - 'from' => $header->get('from')->getFieldBody(), + 'date' => $headers->get('date'), + 'message-id' => $headers->get('message-id'), + 'from' => $headers->get('from'), ]; } - private function formatRecipients(Swift_Message $message): array + private function formatRecipients(Email $message): array { return array_merge( - ['to' => array_keys($message->getTo() ?: [])], - ['cc' => array_keys($message->getCc() ?: [])], - ['bcc' => array_keys($message->getBcc() ?: [])], + ['to' => (new Collection($message->getTo()))->map(fn ($address) => $address->getAddress())->toArray()], + ['cc' => (new Collection($message->getCc()))->map(fn ($address) => $address->getAddress())->toArray()], + ['bcc' => (new Collection($message->getBcc()))->map(fn ($address) => $address->getAddress())->toArray()], ); } private function shouldLog(MessageSent $event): bool { - /* Check package enabled */ - if (!config('mailviewer.enabled')) { + /* Make sure package is enabled */ + if (! config('mailviewer.enabled')) { return false; } - /* Check exclude notification list */ + /* Make sure notification is not in list of excluded notifications */ if (isset($event->data['__laravel_notification']) && in_array($event->data['__laravel_notification'], config('mailviewer.database.exclude.notification') ?? [])) { return false; } - /* Check exclude email list */ - if ($event->message->getTo() && in_array(array_keys($event->message->getTo())[0], config('mailviewer.database.exclude.email') ?? [])) { + /* Make sure recipient is not in list of exlcuded email addresses */ + if ($event->message->getTo() && count((new Collection($event->message->getTo())) + ->map(fn ($address) => $address->getAddress()) + ->reject(fn ($email) => in_array($email, config('mailviewer.database.exclude.email') ?? []))) == 0) { return false; } diff --git a/src/MailViewerServiceProvider.php b/src/MailViewerServiceProvider.php index 23f11ac..0ab6714 100644 --- a/src/MailViewerServiceProvider.php +++ b/src/MailViewerServiceProvider.php @@ -5,7 +5,6 @@ use Illuminate\Support\Facades\Route; use Illuminate\Support\ServiceProvider; use Label84\MailViewer\Console\Commands\CleanupMailViewerItems; -use Label84\MailViewer\Console\Commands\InstallMailViewer; use Label84\MailViewer\Providers\EventServiceProvider; class MailViewerServiceProvider extends ServiceProvider @@ -21,14 +20,13 @@ public function boot(): void __DIR__.'/../resources/views' => resource_path('views/vendor/mailviewer'), ], 'views'); - if (!class_exists('CreateMailViewerItems')) { + if (! class_exists('CreateMailViewerItems')) { $this->publishes([ __DIR__.'/../database/migrations/create_mail_viewer_items_table.php.stub' => database_path('migrations/'.date('Y_m_d_His', time()).'_create_mail_viewer_items_table.php'), ], 'migrations'); } $this->commands([ - InstallMailViewer::class, CleanupMailViewerItems::class, ]); } diff --git a/src/Providers/EventServiceProvider.php b/src/Providers/EventServiceProvider.php index a75ac90..221a639 100644 --- a/src/Providers/EventServiceProvider.php +++ b/src/Providers/EventServiceProvider.php @@ -9,7 +9,9 @@ class EventServiceProvider extends ServiceProvider { protected $listen = [ - MessageSent::class => [CreateMailViewerItem::class], + MessageSent::class => [ + CreateMailViewerItem::class, + ], ]; public function boot(): void diff --git a/tests/Commands/InstallMailViewerTest.php b/tests/Commands/InstallMailViewerTest.php deleted file mode 100644 index 04444f2..0000000 --- a/tests/Commands/InstallMailViewerTest.php +++ /dev/null @@ -1,32 +0,0 @@ -assertFalse(File::exists(config_path('mailviewer.php'))); - - Artisan::call('vendor:publish', [ - '--provider' => "Label84\MailViewer\MailViewerServiceProvider", - '--tag' => 'config' - ]); - - $this->assertTrue(File::exists(config_path('mailviewer.php'))); - } -} diff --git a/tests/Config/ConfigTest.php b/tests/Config/ConfigTest.php index 8c62c13..d5ee373 100644 --- a/tests/Config/ConfigTest.php +++ b/tests/Config/ConfigTest.php @@ -15,7 +15,7 @@ public function setUp(): void } /** @test */ - public function it_wont_create_mail_viewer_items_when_set_disabled() + public function it_does_not_an_item_when_disabled() { config()->set('mailviewer.enabled', false); @@ -25,7 +25,7 @@ public function it_wont_create_mail_viewer_items_when_set_disabled() } /** @test */ - public function it_wont_create_mail_viewer_items_when_notification_in_exclude_notification_list() + public function it_does_not_create_an_item_when_notification_is_in_exclude_notification_list() { config()->set('mailviewer.database.exclude.notification', [ TestNotification::class, @@ -37,7 +37,7 @@ public function it_wont_create_mail_viewer_items_when_notification_in_exclude_no } /** @test */ - public function it_wont_create_mail_viewer_items_when_email_in_exclude_email_list() + public function it_does_not_create_an_item_when_email_is_in_exclude_email_list() { config()->set('mailviewer.database.exclude.email', [ 'info@example.com', diff --git a/tests/Views/ViewTest.php b/tests/Views/ViewTest.php index 70783c5..a326f5c 100644 --- a/tests/Views/ViewTest.php +++ b/tests/Views/ViewTest.php @@ -20,9 +20,15 @@ public function it_has_admin_mailviewer_as_default_route_prefix() } /** @test */ - public function it_has_web_and_auth_as_default_middleware() + public function it_has_web_as_default_middleware() { - $this->assertEquals(['web', 'auth'], config('mailviewer.route.middleware')); + $this->assertEquals(['web'], config('mailviewer.route.middleware')); + } + + /** @test */ + public function it_does_not_have_auth_as_default_middleware() + { + $this->assertNotContains(['auth'], config('mailviewer.route.middleware')); } /** @test */