Skip to content

Commit 7f07143

Browse files
authored
Merge pull request #230 from RonasIT/228_correct_mails_mock_trait_assert_fixture
feat: correct mails mock trait assert fixture
2 parents 43e6aa4 + 8d07d25 commit 7f07143

File tree

3 files changed

+3
-47
lines changed

3 files changed

+3
-47
lines changed

src/Traits/MailsMockTrait.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ protected function assertEmailsList(array $expectedMailData, Mailable $mail, int
174174

175175
protected function assertFixture(array $expectedMailData, Mailable $mail, bool $exportMode = false): void
176176
{
177-
$view = (method_exists($mail, 'content')) ? $mail->content()->view : $mail->view;
178-
$data = (method_exists($mail, 'content')) ? $mail->content()->with : $mail->viewData;
177+
$view = $mail->content()->view;
178+
$data = array_merge($mail->content()->with, $mail->viewData);
179+
179180
$mailContent = view($view, $data)->render();
180181

181182
$globalExportMode = $this->globalExportMode ?? false;

tests/MailsMockTraitTest.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
use Illuminate\Support\Facades\Mail;
77
use PHPUnit\Framework\AssertionFailedError;
88
use PHPUnit\Framework\ExpectationFailedException;
9-
use RonasIT\Support\Tests\Support\Mock\Mails\LegacyTestMail;
109
use RonasIT\Support\Tests\Support\Mock\Mails\TestMail;
1110
use RonasIT\Support\Tests\Support\Mock\Mails\TestMailManyFromWithName;
1211
use RonasIT\Support\Tests\Support\Mock\Mails\TestMailWithAttachments;
@@ -46,24 +45,6 @@ public function testMailWithDifferentQueue()
4645
Mail::assertQueued(fn (TestMail $mail) => $mail->queue === 'different_queue');
4746
}
4847

49-
public function testLegacyMail()
50-
{
51-
Mail::to('[email protected]')->queue(new LegacyTestMail(
52-
['name' => 'John Smith'],
53-
'Test Subject',
54-
'emails.test',
55-
));
56-
57-
$this->assertMailEquals(LegacyTestMail::class, [
58-
[
59-
'emails' => '[email protected]',
60-
'fixture' => 'test_mail.html',
61-
'subject' => 'Test Subject',
62-
'from' => '[email protected]',
63-
],
64-
]);
65-
}
66-
6748
public function testMailFromManyWithName()
6849
{
6950
Mail::to('[email protected]')->queue(new TestMailManyFromWithName(['name' => 'John Smith']));

tests/support/Mock/Mails/LegacyTestMail.php

Lines changed: 0 additions & 26 deletions
This file was deleted.

0 commit comments

Comments
 (0)