Improve NotificationMailerTest by adding an assertion

This assertion is performed by Prophecy's shouldBeCalled* method.
This commit is contained in:
Julien Fastré 2023-09-07 11:12:44 +02:00 committed by Julie Lenaerts
parent 758ad9bc87
commit 207e109d1e

View File

@ -37,7 +37,6 @@ class NotificationMailerTest extends TestCase
*/ */
public function testPostPersistComment(): void public function testPostPersistComment(): void
{ {
$this->expectNotToPerformAssertions();
$user1 = (new User())->setEmail('user1@foo.com'); $user1 = (new User())->setEmail('user1@foo.com');
$user2 = (new User())->setEmail('user2@foo.com'); $user2 = (new User())->setEmail('user2@foo.com');
$user3 = (new User())->setEmail('user3@foo.com'); $user3 = (new User())->setEmail('user3@foo.com');
@ -67,7 +66,7 @@ class NotificationMailerTest extends TestCase
} }
return false; return false;
})); }))->shouldBeCalledTimes(2);
$objectManager = $this->prophesize(EntityManagerInterface::class); $objectManager = $this->prophesize(EntityManagerInterface::class);
@ -77,7 +76,6 @@ class NotificationMailerTest extends TestCase
public function testPostPersistCommentDestWithNullEmail(): void public function testPostPersistCommentDestWithNullEmail(): void
{ {
$this->expectNotToPerformAssertions();
$user1 = (new User())->setEmail('user1@foo.com'); $user1 = (new User())->setEmail('user1@foo.com');
$user2 = (new User())->setEmail('user2@foo.com'); $user2 = (new User())->setEmail('user2@foo.com');
$user3 = (new User())->setEmail(null); $user3 = (new User())->setEmail(null);
@ -107,7 +105,7 @@ class NotificationMailerTest extends TestCase
} }
return false; return false;
})); }))->shouldBeCalledTimes(1);
$objectManager = $this->prophesize(EntityManagerInterface::class); $objectManager = $this->prophesize(EntityManagerInterface::class);