diff options
author | Joas Schilling <coding@schilljs.com> | 2023-07-25 12:08:20 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-27 09:57:53 +0200 |
commit | 44a0a621075962fecd9a3c94e724e2b544f7ce38 (patch) | |
tree | 6743b7adcf4c87fc69173e80533a8c7cbcdddc76 /tests | |
parent | 6953e14580ddc94a11cf4f420f38dae2d1ae2917 (diff) | |
download | nextcloud-server-44a0a621075962fecd9a3c94e724e2b544f7ce38.tar.gz nextcloud-server-44a0a621075962fecd9a3c94e724e2b544f7ce38.zip |
fix: Move Node HookConnecter events to IEventDispatcher
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/Files/Node/HookConnectorTest.php | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/lib/Files/Node/HookConnectorTest.php b/tests/lib/Files/Node/HookConnectorTest.php index 9704c7b89f1..0501c175a5f 100644 --- a/tests/lib/Files/Node/HookConnectorTest.php +++ b/tests/lib/Files/Node/HookConnectorTest.php @@ -31,9 +31,7 @@ use OCP\Files\Events\Node\NodeTouchedEvent; use OCP\Files\Events\Node\NodeWrittenEvent; use OCP\Files\Node; use OCP\IUserManager; -use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; -use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\GenericEvent; use Test\TestCase; use Test\Traits\MountProviderTrait; @@ -50,9 +48,6 @@ class HookConnectorTest extends TestCase { use UserTrait; use MountProviderTrait; - /** @var EventDispatcherInterface|MockObject */ - protected $legacyDispatcher; - /** @var IEventDispatcher */ protected $eventDispatcher; @@ -82,7 +77,6 @@ class HookConnectorTest extends TestCase { $this->createMock(IUserManager::class), $this->createMock(IEventDispatcher::class) ); - $this->legacyDispatcher = \OC::$server->getEventDispatcher(); $this->eventDispatcher = \OC::$server->query(IEventDispatcher::class); } @@ -149,7 +143,7 @@ class HookConnectorTest extends TestCase { * @dataProvider viewToNodeProvider */ public function testViewToNode(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent) { - $connector = new HookConnector($this->root, $this->view, $this->legacyDispatcher, $this->eventDispatcher); + $connector = new HookConnector($this->root, $this->view, $this->eventDispatcher); $connector->viewToNode(); $hookCalled = false; /** @var Node $hookNode */ @@ -163,7 +157,7 @@ class HookConnectorTest extends TestCase { $dispatcherCalled = false; /** @var Node $dispatcherNode */ $dispatcherNode = null; - $this->legacyDispatcher->addListener($expectedLegacyEvent, function ($event) use (&$dispatcherCalled, &$dispatcherNode) { + $this->eventDispatcher->addListener($expectedLegacyEvent, function ($event) use (&$dispatcherCalled, &$dispatcherNode) { /** @var GenericEvent|APIGenericEvent $event */ $dispatcherCalled = true; $dispatcherNode = $event->getSubject(); @@ -218,7 +212,7 @@ class HookConnectorTest extends TestCase { * @dataProvider viewToNodeProviderCopyRename */ public function testViewToNodeCopyRename(callable $operation, $expectedHook, $expectedLegacyEvent, $expectedEvent) { - $connector = new HookConnector($this->root, $this->view, $this->legacyDispatcher, $this->eventDispatcher); + $connector = new HookConnector($this->root, $this->view, $this->eventDispatcher); $connector->viewToNode(); $hookCalled = false; /** @var Node $hookSourceNode */ @@ -237,7 +231,7 @@ class HookConnectorTest extends TestCase { $dispatcherSourceNode = null; /** @var Node $dispatcherTargetNode */ $dispatcherTargetNode = null; - $this->legacyDispatcher->addListener($expectedLegacyEvent, function ($event) use (&$dispatcherSourceNode, &$dispatcherTargetNode, &$dispatcherCalled) { + $this->eventDispatcher->addListener($expectedLegacyEvent, function ($event) use (&$dispatcherSourceNode, &$dispatcherTargetNode, &$dispatcherCalled) { /** @var GenericEvent|APIGenericEvent $event */ $dispatcherCalled = true; [$dispatcherSourceNode, $dispatcherTargetNode] = $event->getSubject(); @@ -273,7 +267,7 @@ class HookConnectorTest extends TestCase { } public function testPostDeleteMeta() { - $connector = new HookConnector($this->root, $this->view, $this->legacyDispatcher, $this->eventDispatcher); + $connector = new HookConnector($this->root, $this->view, $this->eventDispatcher); $connector->viewToNode(); $hookCalled = false; /** @var Node $hookNode */ @@ -287,7 +281,7 @@ class HookConnectorTest extends TestCase { $dispatcherCalled = false; /** @var Node $dispatcherNode */ $dispatcherNode = null; - $this->legacyDispatcher->addListener('\OCP\Files::postDelete', function ($event) use (&$dispatcherCalled, &$dispatcherNode) { + $this->eventDispatcher->addListener('\OCP\Files::postDelete', function ($event) use (&$dispatcherCalled, &$dispatcherNode) { /** @var GenericEvent|APIGenericEvent $event */ $dispatcherCalled = true; $dispatcherNode = $event->getSubject(); |