Skip to content
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

#140: Global export mode not affect for email testing #159

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions src/Traits/MailsMockTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ protected function assertMailEquals(string $mailableClass, $emailChain, bool $ex
$emailChain = $this->prepareEmailChain($emailChain);
$index = 0;

if (!$exportMode) {
aizlee marked this conversation as resolved.
Show resolved Hide resolved
$exportMode = $this->globalExportMode ?? false;
}

Mail::assertQueued($mailableClass, $this->assertSentCallback($emailChain, $index, $exportMode));

$this->assertCountMails($emailChain, $index);
Expand Down
13 changes: 13 additions & 0 deletions tests/MailsMockTraitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,19 @@ public function testMailWithExport()
$this->assertFileExists($this->getFixturePath('test_mail_with_export.html'));
}

public function testMailWithGlobalExportMod()
yogyrton marked this conversation as resolved.
Show resolved Hide resolved
{
putenv('FAIL_EXPORT_JSON=false');

Mail::to('[email protected]')->queue(new TestMail(['name' => 'John Smith']));

$this->assertMailEquals(TestMail::class, [
$this->mockedMail('[email protected]', 'test_mail_with_export.html', 'Test Subject'),
yogyrton marked this conversation as resolved.
Show resolved Hide resolved
]);

$this->assertFileExists($this->getFixturePath('test_mail_with_export.html'));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why you checking test_mail_with_export.html file, but asserting content with the test_mail_with_global_export.html?

}

public function testMailWithIncorrectSubject()
{
$this->expectException(ExpectationFailedException::class);
Expand Down
Loading