diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-02-08 11:34:19 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-02-09 10:47:14 +0100 |
commit | abc61a9f63ba088aaea5b3c64d2db3316887061e (patch) | |
tree | 892b75fd10c47c3a36300d139a61e4231b1c19f8 /tests/lib/EventDispatcher | |
parent | 9eea1e56dc0c33c504fb0e98578e22115b6b4c79 (diff) | |
download | nextcloud-server-abc61a9f63ba088aaea5b3c64d2db3316887061e.tar.gz nextcloud-server-abc61a9f63ba088aaea5b3c64d2db3316887061e.zip |
Fix the legacy dispatcher argument order
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/EventDispatcher')
-rw-r--r-- | tests/lib/EventDispatcher/SymfonyAdapterTest.php | 36 |
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'; |