summaryrefslogtreecommitdiffstats
path: root/tests/lib/EventDispatcher
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/EventDispatcher')
-rw-r--r--tests/lib/EventDispatcher/SymfonyAdapterTest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/lib/EventDispatcher/SymfonyAdapterTest.php b/tests/lib/EventDispatcher/SymfonyAdapterTest.php
index b1d43bf2661..5e2803624af 100644
--- a/tests/lib/EventDispatcher/SymfonyAdapterTest.php
+++ b/tests/lib/EventDispatcher/SymfonyAdapterTest.php
@@ -100,6 +100,26 @@ class SymfonyAdapterTest extends TestCase {
self::assertEquals($result, $wrapped);
}
+ public function testDispatchOldSymfonyEventWithFlippedArgumentOrder(): void {
+ $event = new SymfonyEvent();
+ $eventName = 'symfony';
+ $symfonyDispatcher = $this->createMock(SymfonyDispatcher::class);
+ $this->eventDispatcher->expects(self::once())
+ ->method('getSymfonyDispatcher')
+ ->willReturn($symfonyDispatcher);
+ $symfonyDispatcher->expects(self::once())
+ ->method('dispatch')
+ ->with(
+ $event,
+ $eventName
+ )
+ ->willReturnArgument(0);
+
+ $result = $this->adapter->dispatch($event, $eventName);
+
+ self::assertSame($result, $event);
+ }
+
public function testDispatchOldSymfonyEvent(): void {
$event = new SymfonyEvent();
$eventName = 'symfony';
@@ -120,6 +140,22 @@ class SymfonyAdapterTest extends TestCase {
self::assertSame($result, $event);
}
+ public function testDispatchCustomGenericEventWithFlippedArgumentOrder(): void {
+ $event = new GenericEvent();
+ $eventName = 'symfony';
+ $this->eventDispatcher->expects(self::once())
+ ->method('dispatch')
+ ->with(
+ $eventName,
+ $event
+ )
+ ->willReturnArgument(0);
+
+ $result = $this->adapter->dispatch($event, $eventName);
+
+ self::assertSame($result, $event);
+ }
+
public function testDispatchCustomGenericEvent(): void {
$event = new GenericEvent();
$eventName = 'symfony';