Skip to content

8.x #65

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Mar 16, 2025
Merged

8.x #65

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions src/Email.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/EmailComposer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -141,15 +141,15 @@ public function mailable(Mailable $mailable): self
{
$this->mailable = $mailable;

(new MailableReader())->read($this);
(new MailableReader)->read($this);

return $this;
}

public function send(): Email
{
if ($this->envelope && $this->content) {
(new MailableReader())->read($this);
(new MailableReader)->read($this);
}

if (! is_array($this->email->from)) {
Expand Down
2 changes: 1 addition & 1 deletion src/SentMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Store
*/
public function getQueue(): LazyCollection
{
$query = new Email();
$query = new Email;

return Email::query()
->whereNull('deleted_at')
Expand Down
4 changes: 2 additions & 2 deletions tests/ComposeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
Expand Down
20 changes: 10 additions & 10 deletions tests/EnvelopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ public function test_it_can_set_the_envelope()
{
$email = Email::compose()
->envelope(
(new Envelope())
(new Envelope)
->subject('Hey')
->from('[email protected]')
->to(['[email protected]', '[email protected]'])
)
->content(
(new Content())
(new Content)
->view('tests::dummy')
->with(['name' => 'John Doe'])
)
Expand All @@ -40,15 +40,15 @@ 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' => '[email protected]',
'name' => 'J. Doe',
]);

$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(
Expand All @@ -62,15 +62,15 @@ 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' => '[email protected]',
'name' => 'J. Doe',
]);

$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(
Expand All @@ -84,15 +84,15 @@ 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' => '[email protected]',
'name' => 'J. Doe',
]);

$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(
Expand All @@ -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' => '[email protected]',
'name' => 'J. Doe',
]);
Expand All @@ -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' => '[email protected]',
'name' => 'J. Doe',
]);
Expand Down
2 changes: 1 addition & 1 deletion tests/MailableReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MailableReaderTest extends TestCase
{
private function mailable(): Mailable
{
return new TestMailable();
return new TestMailable;
}

#[Test]
Expand Down
2 changes: 1 addition & 1 deletion tests/SenderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class SenderTest extends TestCase
/** @var array<SentMessage> */
public $sent = [];

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand Down
7 changes: 3 additions & 4 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class TestCase extends \Orchestra\Testbench\TestCase
use RefreshDatabase;
use WithWorkbench;

public function setUp(): void
protected function setUp(): void
{
parent::setUp();

Expand All @@ -26,10 +26,9 @@ public function setUp(): void
1,
1.0,
'test',
new \stdClass(),
new \stdClass,
(object) [],
function () {
},
function () {},
];

view()->addNamespace('tests', __DIR__.'/views');
Expand Down
1 change: 1 addition & 0 deletions tests/views/welcome.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Welcome
4 changes: 1 addition & 3 deletions workbench/app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@

use Illuminate\Foundation\Auth\User as UserAlias;

class User extends UserAlias
{
}
class User extends UserAlias {}
Loading