Skip to content

Commit

Permalink
[minor] Update dependencies, improve mailer test (#273)
Browse files Browse the repository at this point in the history
  • Loading branch information
IonBazan authored Jun 8, 2022
1 parent 34b6b75 commit 91d1c30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
12 changes: 4 additions & 8 deletions Tests/Helper/SymfonyMailerReporterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ class SymfonyMailerReporterTest extends TestCase

protected function setUp(): void
{
if (!interface_exists(MailerInterface::class)) {
$this->markTestSkipped('Symfony Mailer not available.');
}

$this->mailer = $this->createMock(MailerInterface::class);
}

Expand All @@ -35,16 +31,16 @@ public function testSendMail(array $recipients, string $sender, string $subject)
{
$reporter = new SymfonyMailerReporter($this->mailer, $recipients, $sender, $subject);

$check = $this->prophesize(CheckInterface::class);
$check->getLabel()->willReturn('Some Label');
$check = $this->createStub(CheckInterface::class);
$check->method('getLabel')->willReturn('Some Label');

$checks = new Collection();
$checks[$check->reveal()] = new Failure('Something goes wrong');
$checks[$check] = new Failure('Something goes wrong');

$this->mailer
->expects(self::once())
->method('send')
->with(self::callback(function (?Email $message) use ($recipients, $sender, $subject): bool {
->with(self::callback(static function (Email $message) use ($recipients, $sender, $subject): bool {
self::assertEquals(Address::createArray($recipients), $message->getTo(), 'Check if Recipient is sent correctly.');
self::assertEquals([Address::create($sender)], $message->getFrom(), 'Check that the from header is set correctly.');
self::assertSame($subject, $message->getSubject(), 'Check that the subject has been set.');
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"symfony/browser-kit": "^4.4 || ^5.0 || ^6.0",
"symfony/asset": "^4.4 || ^5.0 || ^6.0",
"symfony/templating": "^4.4 || ^5.0 || ^6.0",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0",
"symfony/mailer": "^4.4 || ^5.0 || ^6.0",
"phpunit/phpunit": "^9.0",
"symfony/finder": "^4.4 || ^5.0 || ^6.0",
"friendsofphp/php-cs-fixer": "^3.4",
"doctrine/persistence": "^1.3.3 || ^2.0"
"doctrine/persistence": "^1.3.3 || ^2.0 || ^3.0"
},
"suggest": {
"sensio/distribution-bundle": "To be able to use the composer ScriptHandler",
"symfony/expression-language": "To use the Expression check"
},
"autoload": {
Expand Down

0 comments on commit 91d1c30

Please sign in to comment.