From a9c40baa8741324235bdf600d539f2f4d8c2c389 Mon Sep 17 00:00:00 2001 From: Yarre Date: Fri, 22 Oct 2021 12:07:49 +0200 Subject: [PATCH] Fix event name assertion Fix: `pretty` key contains the listener name and the `event` is the actual name that should be compared with the expected name. --- src/Codeception/Module/Symfony/EventsAssertionsTrait.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Codeception/Module/Symfony/EventsAssertionsTrait.php b/src/Codeception/Module/Symfony/EventsAssertionsTrait.php index f2b0b63e..afcd7cd8 100644 --- a/src/Codeception/Module/Symfony/EventsAssertionsTrait.php +++ b/src/Codeception/Module/Symfony/EventsAssertionsTrait.php @@ -154,8 +154,9 @@ protected function eventWasTriggered(array $actual, string $expectedEvent): bool foreach ($actual as $actualEvent) { if (is_array($actualEvent)) { // Called Listeners - if (strpos($actualEvent['pretty'], $expectedEvent) === 0) { + if (strpos($actualEvent['event'], $expectedEvent) === 0) { $triggered = true; + break; } } else { // Orphan Events if ($actualEvent === $expectedEvent) { @@ -170,4 +171,4 @@ protected function grabEventCollector(string $function): EventDataCollector { return $this->grabCollector('events', $function); } -} \ No newline at end of file +}