diff --git a/tests/Console/CleanEmailsTest.php b/tests/Console/CleanEmailsTest.php index 5f18272..805d264 100644 --- a/tests/Console/CleanEmailsTest.php +++ b/tests/Console/CleanEmailsTest.php @@ -20,8 +20,7 @@ public function setUp(): void $this->app['config']->set('mailbox.store_incoming_emails_for_days', 31); } - /** @test */ - public function it_can_clean_the_statistics() + public function test_can_clean_the_statistics() { Collection::times(200)->each(function (int $index) { InboundEmail::forceCreate([ @@ -41,8 +40,7 @@ public function it_can_clean_the_statistics() $this->assertCount(0, InboundEmail::where('created_at', '<', $cutOffDate)->get()); } - /** @test */ - public function it_errors_if_max_age_inf() + public function test_errors_if_max_age_inf() { $this->app['config']->set('mailbox.store_incoming_emails_for_days', INF); diff --git a/tests/Controllers/MailgunTest.php b/tests/Controllers/MailgunTest.php index af10733..34fe7df 100644 --- a/tests/Controllers/MailgunTest.php +++ b/tests/Controllers/MailgunTest.php @@ -13,8 +13,7 @@ protected function getEnvironmentSetUp($app) $app['config']['mailbox.driver'] = 'mailgun'; } - /** @test */ - public function it_verifies_mailgun_signatures() + public function test_verifies_mailgun_signatures() { $this->post('/laravel-mailbox/mailgun/mime', [ 'body-mime' => 'mime', @@ -38,8 +37,7 @@ public function it_verifies_mailgun_signatures() ])->assertStatus(200); } - /** @test */ - public function it_verifies_fresh_timestamps() + public function test_verifies_fresh_timestamps() { $timestamp = now()->subMinutes(5)->timestamp; $token = uniqid(); diff --git a/tests/Controllers/PostmarkTest.php b/tests/Controllers/PostmarkTest.php index 2e7d4f8..09cd84e 100644 --- a/tests/Controllers/PostmarkTest.php +++ b/tests/Controllers/PostmarkTest.php @@ -13,8 +13,7 @@ protected function getEnvironmentSetUp($app) $app['config']['mailbox.driver'] = 'postmark'; } - /** @test */ - public function it_expects_to_receive_raw_email_field() + public function test_expects_to_receive_raw_email_field() { $this->withoutMiddleware(); diff --git a/tests/Drivers/LogTest.php b/tests/Drivers/LogTest.php index 4cdb5a2..41a1162 100644 --- a/tests/Drivers/LogTest.php +++ b/tests/Drivers/LogTest.php @@ -18,8 +18,7 @@ protected function getEnvironmentSetUp($app) $app['config']['mailbox.driver'] = 'log'; } - /** @test */ - public function it_catches_logged_mails() + public function test_catches_logged_mails() { Mailbox::from('{name}@beyondco.de', function (InboundEmail $email, $name) { $this->assertSame($name, 'example'); diff --git a/tests/InboundEmailTest.php b/tests/InboundEmailTest.php index 8a54b9a..8e9c4bf 100644 --- a/tests/InboundEmailTest.php +++ b/tests/InboundEmailTest.php @@ -17,8 +17,7 @@ protected function getEnvironmentSetUp($app) $app['config']['mailbox.driver'] = 'log'; } - /** @test */ - public function it_stores_inbound_emails() + public function test_stores_inbound_emails() { Mailbox::to('someone@beyondco.de', function ($email) { }); @@ -29,8 +28,7 @@ public function it_stores_inbound_emails() $this->assertSame(1, InboundEmail::query()->count()); } - /** @test */ - public function it_stores_all_inbound_emails() + public function test_stores_all_inbound_emails() { $this->app['config']['mailbox.only_store_matching_emails'] = false; @@ -43,8 +41,7 @@ public function it_stores_all_inbound_emails() $this->assertSame(2, InboundEmail::query()->count()); } - /** @test */ - public function it_can_use_fallbacks() + public function test_can_use_fallbacks() { Mailbox::fallback(function (InboundEmail $email) { Mail::fake(); @@ -57,8 +54,7 @@ public function it_can_use_fallbacks() Mail::assertSent(ReplyMail::class); } - /** @test */ - public function it_can_use_catchall() + public function test_can_use_catchall() { Mailbox::to('someone@beyondco.de', function ($email) { }); @@ -74,8 +70,7 @@ public function it_can_use_catchall() Mail::assertSent(ReplyMail::class); } - /** @test */ - public function it_stores_inbound_emails_with_catchall() + public function test_stores_inbound_emails_with_catchall() { Mailbox::catchAll(function ($email) { }); @@ -86,8 +81,7 @@ public function it_stores_inbound_emails_with_catchall() $this->assertSame(2, InboundEmail::query()->count()); } - /** @test */ - public function it_stores_inbound_emails_with_fallback() + public function test_stores_inbound_emails_with_fallback() { Mailbox::fallback(function ($email) { }); @@ -98,8 +92,7 @@ public function it_stores_inbound_emails_with_fallback() $this->assertSame(2, InboundEmail::query()->count()); } - /** @test */ - public function it_stores_inbound_emails_with_fallback_and_catchall_only_once() + public function test_stores_inbound_emails_with_fallback_and_catchall_only_once() { Mailbox::fallback(function ($email) { }); @@ -113,8 +106,7 @@ public function it_stores_inbound_emails_with_fallback_and_catchall_only_once() $this->assertSame(2, InboundEmail::query()->count()); } - /** @test */ - public function it_does_not_store_inbound_emails_if_configured() + public function test_does_not_store_inbound_emails_if_configured() { $this->app['config']['mailbox.store_incoming_emails_for_days'] = 0; @@ -127,8 +119,7 @@ public function it_does_not_store_inbound_emails_if_configured() $this->assertSame(0, InboundEmail::query()->count()); } - /** @test */ - public function it_can_reply_to_mails() + public function test_can_reply_to_mails() { Mailbox::from('example@beyondco.de', function (InboundEmail $email) { Mail::fake(); @@ -141,8 +132,7 @@ public function it_can_reply_to_mails() Mail::assertSent(ReplyMail::class); } - /** @test */ - public function it_uses_the_configured_model() + public function test_uses_the_configured_model() { $this->app['config']['mailbox.model'] = ExtendedInboundEmail::class; diff --git a/tests/MailboxRouteCollectionTest.php b/tests/MailboxRouteCollectionTest.php index fa3c027..dbab63e 100644 --- a/tests/MailboxRouteCollectionTest.php +++ b/tests/MailboxRouteCollectionTest.php @@ -9,8 +9,7 @@ class MailboxRouteCollectionTest extends TestCase { - /** @test */ - public function it_returns_all_matching_mailbox_routes() + public function test_returns_all_matching_mailbox_routes() { $collection = new RouteCollection(); diff --git a/tests/MailboxRouteTest.php b/tests/MailboxRouteTest.php index 5adfcd0..0058b85 100644 --- a/tests/MailboxRouteTest.php +++ b/tests/MailboxRouteTest.php @@ -5,6 +5,7 @@ use BeyondCode\Mailbox\InboundEmail; use BeyondCode\Mailbox\Routing\Route; use Laminas\Mail\Message as TestMail; +use PHPUnit\Framework\Attributes\DataProvider; class MailboxRouteTest extends TestCase { @@ -15,13 +16,10 @@ public static function emailDataProvider() ['hello@beyondco.de', '{name}@beyondco.de', 'wrong@beyondco.com'], ]; } + - /** - * @test - * - * @dataProvider emailDataProvider - */ - public function it_matches_from_mails($fromMail, $successfulPattern, $failingPattern) + #[DataProvider('emailDataProvider')] + public function test_matches_from_mails($fromMail, $successfulPattern, $failingPattern) { $testMail = (new TestMail()) ->setFrom($fromMail); @@ -35,12 +33,9 @@ public function it_matches_from_mails($fromMail, $successfulPattern, $failingPat $this->assertFalse($route->matches($message)); } - /** - * @test - * - * @dataProvider emailDataProvider - */ - public function it_matches_to_mails($toMail, $successfulPattern, $failingPattern) + + #[DataProvider('emailDataProvider')] + public function test_matches_to_mails($toMail, $successfulPattern, $failingPattern) { $testMail = (new TestMail()) ->setTo($toMail); @@ -53,13 +48,10 @@ public function it_matches_to_mails($toMail, $successfulPattern, $failingPattern $route = new Route(Route::TO, $failingPattern, 'SomeAction@handle'); $this->assertFalse($route->matches($message)); } + - /** - * @test - * - * @dataProvider emailDataProvider - */ - public function it_matches_cc_mails($ccMail, $successfulPattern, $failingPattern) + #[DataProvider('emailDataProvider')] + public function test_matches_cc_mails($ccMail, $successfulPattern, $failingPattern) { $testMail = (new TestMail()) ->setCc($ccMail); @@ -73,12 +65,9 @@ public function it_matches_cc_mails($ccMail, $successfulPattern, $failingPattern $this->assertFalse($route->matches($message)); } - /** - * @test - * - * @dataProvider emailDataProvider - */ - public function it_matches_bcc_mails($bccMail, $successfulPattern, $failingPattern) + + #[DataProvider('emailDataProvider')] + public function test_matches_bcc_mails($bccMail, $successfulPattern, $failingPattern) { $testMail = (new TestMail()) ->setBcc($bccMail); @@ -92,12 +81,8 @@ public function it_matches_bcc_mails($bccMail, $successfulPattern, $failingPatte $this->assertFalse($route->matches($message)); } - /** - * @test - * - * @dataProvider subjectDataProvider - */ - public function it_matches_subjects($subject, $successfulPattern, $failingPattern) + #[DataProvider('subjectDataProvider')] + public function test_matches_subjects($subject, $successfulPattern, $failingPattern) { $testMail = (new TestMail()) ->setSubject($subject); @@ -111,8 +96,7 @@ public function it_matches_subjects($subject, $successfulPattern, $failingPatter $this->assertFalse($route->matches($message)); } - /** @test */ - public function it_matches_requirements() + public function test_matches_requirements() { $testMail = (new TestMail()) ->setFrom('abc@domain.com'); @@ -138,8 +122,7 @@ public static function subjectDataProvider() ]; } - /** @test */ - public function it_returns_parameter_names() + public function test_returns_parameter_names() { $route = new Route(Route::FROM, 'someone@domain.com', 'SomeAction@handle'); @@ -160,8 +143,7 @@ public function it_returns_parameter_names() ], $route->parameterNames()); } - /** @test */ - public function it_returns_parameter_values() + public function test_returns_parameter_values() { $testMail = (new TestMail()) ->setFrom('my-email@foo.com') @@ -200,8 +182,7 @@ public function it_returns_parameter_values() ], $route->parameters()); } - /** @test */ - public function it_runs_callables() + public function test_runs_callables() { $testMail = (new TestMail()) ->setFrom('marcel@beyondco.de'); @@ -217,8 +198,7 @@ public function it_runs_callables() $route->run($message); } - /** @test */ - public function it_passes_parameters_to_callables() + public function test_passes_parameters_to_callables() { $testMail = (new TestMail()) ->setFrom('marcel@beyondco.de');