diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6790273..0fb5351 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -66,9 +66,9 @@ jobs: payload: - { laravel: '11.*', php: '8.3', 'testbench': '9.*', collision: '8.*' } - { laravel: '11.*', php: '8.2', 'testbench': '9.*', collision: '8.*' } - - { laravel: '10.*', php: '8.3', 'testbench': '8.*', collision: '7.*' } - - { laravel: '10.*', php: '8.2', 'testbench': '8.*', collision: '7.*' } - - { laravel: '10.*', php: '8.1', 'testbench': '8.*', collision: '7.*' } + - { laravel: '12.*', php: '8.2', 'testbench': '10.*', collision: '8.*' } + - { laravel: '12.*', php: '8.3', 'testbench': '10.*', collision: '8.*' } + - { laravel: '12.*', php: '8.4', 'testbench': '10.*', collision: '8.*' } name: PHP ${{ matrix.payload.php }} - Laravel ${{ matrix.payload.laravel }} - DB ${{ matrix.db }} diff --git a/README.md b/README.md index d7a559d..a9fd99f 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This package allows you to store and send e-mails using the database. # Requirements -This package requires Laravel 10 or 11. +This package requires Laravel 11 or 12. # Installation diff --git a/composer.json b/composer.json index 91cc849..720c56d 100644 --- a/composer.json +++ b/composer.json @@ -30,13 +30,13 @@ }, "require": { "ext-json": "*", - "laravel/framework": "^10.0|^11.0", - "doctrine/dbal": "^3.8" + "laravel/framework": "^11.0|^12.0", + "doctrine/dbal": "^4.0" }, "require-dev": { "mockery/mockery": "^1.2", - "orchestra/testbench": "^8.0|^9.0", - "nunomaduro/collision": "^7.0|^8.0", + "orchestra/testbench": "^9.0|^10.0", + "nunomaduro/collision": "^8.0", "laravel/pint": "^1.14" }, "minimum-stability": "dev", @@ -45,8 +45,8 @@ "l11": [ "composer update laravel/framework:11.* orchestra/testbench:9.* nunomaduro/collision:8.* --with-all-dependencies" ], - "l10": [ - "composer update laravel/framework:10.* orchestra/testbench:8.* nunomaduro/collision:7.* --with-all-dependencies" + "l12": [ + "composer update laravel/framework:12.* orchestra/testbench:10.* nunomaduro/collision:8.* --with-all-dependencies" ], "test": [ "testbench workbench:create-sqlite-db", diff --git a/src/Email.php b/src/Email.php index 5053ca7..d26a568 100644 --- a/src/Email.php +++ b/src/Email.php @@ -57,7 +57,7 @@ class Email extends Model public static function compose(): EmailComposer { - return new EmailComposer(new static()); + return new EmailComposer(new static); } public function isSent(): bool @@ -99,7 +99,7 @@ public function markAsFailed(Throwable $exception): void public function send(): void { - (new Sender())->send($this); + (new Sender)->send($this); } public static function pruneWhen(Closure $closure): void diff --git a/src/EmailComposer.php b/src/EmailComposer.php index 1edb0aa..67efc25 100644 --- a/src/EmailComposer.php +++ b/src/EmailComposer.php @@ -45,7 +45,7 @@ public function __construct(public Email $email) public function envelope(null|Envelope|Closure $envelope = null): self { if ($envelope instanceof Closure) { - $this->envelope = $envelope($this->envelope ?: new Envelope()); + $this->envelope = $envelope($this->envelope ?: new Envelope); return $this; } @@ -58,7 +58,7 @@ public function envelope(null|Envelope|Closure $envelope = null): self public function content(null|Content|Closure $content = null): self { if ($content instanceof Closure) { - $this->content = $content($this->content ?: new Content()); + $this->content = $content($this->content ?: new Content); return $this; } @@ -141,7 +141,7 @@ public function mailable(Mailable $mailable): self { $this->mailable = $mailable; - (new MailableReader())->read($this); + (new MailableReader)->read($this); return $this; } @@ -149,7 +149,7 @@ public function mailable(Mailable $mailable): self public function send(): Email { if ($this->envelope && $this->content) { - (new MailableReader())->read($this); + (new MailableReader)->read($this); } if (! is_array($this->email->from)) { diff --git a/src/SentMessage.php b/src/SentMessage.php index f3dff66..9e075da 100644 --- a/src/SentMessage.php +++ b/src/SentMessage.php @@ -29,7 +29,7 @@ class SentMessage public static function createFromSymfonyMailer(Email $email): SentMessage { - $sentMessage = new self(); + $sentMessage = new self; foreach ($email->getFrom() as $address) { $sentMessage->from[$address->getAddress()] = $address->getName(); diff --git a/src/Store.php b/src/Store.php index bd26544..653c5ff 100644 --- a/src/Store.php +++ b/src/Store.php @@ -17,7 +17,7 @@ class Store */ public function getQueue(): LazyCollection { - $query = new Email(); + $query = new Email; return Email::query() ->whereNull('deleted_at') diff --git a/tests/ComposeTest.php b/tests/ComposeTest.php index 49e88b9..f823bc9 100644 --- a/tests/ComposeTest.php +++ b/tests/ComposeTest.php @@ -25,7 +25,7 @@ public function models_can_be_attached(): void ->user($user) ->model($user) ->envelope(fn (Envelope $envelope) => $envelope->subject('Hey')) - ->content(fn (Content $content) => $content->view('welcome')) + ->content(fn (Content $content) => $content->view('tests::welcome')) ->send(); $this->assertEquals($email->model_type, $user->getMorphClass()); @@ -44,7 +44,7 @@ public function models_can_be_empty(): void $email = Email::compose() ->user($user) ->envelope(fn (Envelope $envelope) => $envelope->subject('Hey')) - ->content(fn (Content $content) => $content->view('welcome')) + ->content(fn (Content $content) => $content->view('tests::welcome')) ->send(); $this->assertNull($email->model_type); diff --git a/tests/EnvelopeTest.php b/tests/EnvelopeTest.php index 4e29bc1..bc96437 100644 --- a/tests/EnvelopeTest.php +++ b/tests/EnvelopeTest.php @@ -19,13 +19,13 @@ public function test_it_can_set_the_envelope() { $email = Email::compose() ->envelope( - (new Envelope()) + (new Envelope) ->subject('Hey') ->from('asdf@gmail.com') ->to(['johndoe@example.com', 'janedoe@example.com']) ) ->content( - (new Content()) + (new Content) ->view('tests::dummy') ->with(['name' => 'John Doe']) ) @@ -40,7 +40,7 @@ public function test_it_can_set_the_envelope() #[Test] public function test_it_can_pass_user_models() { - $user = (new User())->forceFill([ + $user = (new User)->forceFill([ 'email' => 'johndoe@example.com', 'name' => 'J. Doe', ]); @@ -48,7 +48,7 @@ public function test_it_can_pass_user_models() $email = Email::compose() ->user($user) ->envelope(fn (Envelope $envelope) => $envelope->subject('Hey')) - ->content(fn (Content $content) => $content->view('welcome')) + ->content(fn (Content $content) => $content->view('tests::welcome')) ->send(); $this->assertEquals( @@ -62,7 +62,7 @@ public function test_it_can_pass_user_models() #[Test] public function users_can_have_a_preferred_email() { - $user = (new UserWithPreferredEmail())->forceFill([ + $user = (new UserWithPreferredEmail)->forceFill([ 'email' => 'johndoe@example.com', 'name' => 'J. Doe', ]); @@ -70,7 +70,7 @@ public function users_can_have_a_preferred_email() $email = Email::compose() ->user($user) ->envelope(fn (Envelope $envelope) => $envelope->subject('Hey')) - ->content(fn (Content $content) => $content->view('welcome')) + ->content(fn (Content $content) => $content->view('tests::welcome')) ->send(); $this->assertEquals( @@ -84,7 +84,7 @@ public function users_can_have_a_preferred_email() #[Test] public function users_can_have_a_preferred_name() { - $user = (new UserWithPreferredName())->forceFill([ + $user = (new UserWithPreferredName)->forceFill([ 'email' => 'johndoe@example.com', 'name' => 'J. Doe', ]); @@ -92,7 +92,7 @@ public function users_can_have_a_preferred_name() $email = Email::compose() ->user($user) ->envelope(fn (Envelope $envelope) => $envelope->subject('Hey')) - ->content(fn (Content $content) => $content->view('welcome')) + ->content(fn (Content $content) => $content->view('tests::welcome')) ->send(); $this->assertEquals( @@ -106,7 +106,7 @@ public function users_can_have_a_preferred_name() #[Test] public function users_can_have_a_preferred_locale() { - $nonLocaleUser = (new User())->forceFill([ + $nonLocaleUser = (new User)->forceFill([ 'email' => 'johndoe@example.com', 'name' => 'J. Doe', ]); @@ -117,7 +117,7 @@ public function users_can_have_a_preferred_locale() ->content(fn (Content $content) => $content->view('locale-email')) ->send(); - $localeUser = (new UserWithPreferredLocale())->forceFill([ + $localeUser = (new UserWithPreferredLocale)->forceFill([ 'email' => 'johndoe@example.com', 'name' => 'J. Doe', ]); diff --git a/tests/MailableReaderTest.php b/tests/MailableReaderTest.php index 42a5e6b..bf98627 100644 --- a/tests/MailableReaderTest.php +++ b/tests/MailableReaderTest.php @@ -14,7 +14,7 @@ class MailableReaderTest extends TestCase { private function mailable(): Mailable { - return new TestMailable(); + return new TestMailable; } #[Test] diff --git a/tests/SenderTest.php b/tests/SenderTest.php index be8a295..4f08d2a 100644 --- a/tests/SenderTest.php +++ b/tests/SenderTest.php @@ -17,7 +17,7 @@ class SenderTest extends TestCase /** @var array */ public $sent = []; - public function setUp(): void + protected function setUp(): void { parent::setUp(); diff --git a/tests/TestCase.php b/tests/TestCase.php index e638a4c..27e2d16 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -16,7 +16,7 @@ class TestCase extends \Orchestra\Testbench\TestCase use RefreshDatabase; use WithWorkbench; - public function setUp(): void + protected function setUp(): void { parent::setUp(); @@ -26,10 +26,9 @@ public function setUp(): void 1, 1.0, 'test', - new \stdClass(), + new \stdClass, (object) [], - function () { - }, + function () {}, ]; view()->addNamespace('tests', __DIR__.'/views'); diff --git a/tests/views/welcome.blade.php b/tests/views/welcome.blade.php new file mode 100644 index 0000000..01f3f00 --- /dev/null +++ b/tests/views/welcome.blade.php @@ -0,0 +1 @@ +Welcome \ No newline at end of file diff --git a/workbench/app/Models/User.php b/workbench/app/Models/User.php index d4ad593..80b9abf 100644 --- a/workbench/app/Models/User.php +++ b/workbench/app/Models/User.php @@ -6,6 +6,4 @@ use Illuminate\Foundation\Auth\User as UserAlias; -class User extends UserAlias -{ -} +class User extends UserAlias {}