Skip to content

Commit 06825cb

Browse files
add check for symfony version for notifier assertions
1 parent 572a74f commit 06825cb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Codeception/Module/Symfony/NotifierAssertionsTrait.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Symfony\Component\Notifier\EventListener\NotificationLoggerListener;
1212
use Symfony\Component\Notifier\Message\MessageInterface;
1313
use Symfony\Component\Notifier\Test\Constraint as NotifierConstraint;
14+
use Symfony\Component\HttpKernel\Kernel;
1415

1516
trait NotifierAssertionsTrait
1617
{
@@ -69,8 +70,7 @@ public function assertNotificationIsQueued(MessageEvent $event, string $message
6970
*/
7071
public function assertNotificationSubjectContains(MessageInterface $notification, string $text, string $message = ''): void
7172
{
72-
$bbep = $this->assertThat($notification, new NotifierConstraint\NotificationSubjectContains($text), $message);
73-
$test = $notification;
73+
$this->assertThat($notification, new NotifierConstraint\NotificationSubjectContains($text), $message);
7474
}
7575

7676
/**
@@ -240,6 +240,10 @@ public function getNotifierMessage(int $index = 0, ?string $transportName = null
240240

241241
protected function getNotificationEvents(): NotificationEvents
242242
{
243+
if (version_compare(Kernel::VERSION, '6.2', '<')) {
244+
Assert::fail('Notifier assertions require Symfony 6.2 or higher.');
245+
}
246+
243247
$notifier = $this->getService('notifier.notification_logger_listener');
244248
if ($notifier instanceof NotificationLoggerListener) {
245249
return $notifier->getEvents();

0 commit comments

Comments
 (0)