Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-08 13:34:19 +0300
committerChristoph Wurst <christoph@winzerhof-wurst.at>2021-02-09 12:47:14 +0300
commitabc61a9f63ba088aaea5b3c64d2db3316887061e (patch)
tree892b75fd10c47c3a36300d139a61e4231b1c19f8 /tests/lib/EventDispatcher
parent9eea1e56dc0c33c504fb0e98578e22115b6b4c79 (diff)
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.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';