diff options
author | Joas Schilling <coding@schilljs.com> | 2023-07-07 11:30:58 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-19 17:37:34 +0200 |
commit | aa039c986a3e8aaa97569d65ff1afd47a9b94a53 (patch) | |
tree | f4b40fde0f75197d193f87043f5134b02f345670 /apps/workflowengine | |
parent | 4877d0b62e1be0a3b726c901e9a1f986fa1a11c5 (diff) | |
download | nextcloud-server-aa039c986a3e8aaa97569d65ff1afd47a9b94a53.tar.gz nextcloud-server-aa039c986a3e8aaa97569d65ff1afd47a9b94a53.zip |
fix(workflowengine): Remove legacy event (deprecated since 17)
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/workflowengine')
-rw-r--r-- | apps/workflowengine/lib/Manager.php | 10 | ||||
-rw-r--r-- | apps/workflowengine/tests/ManagerTest.php | 12 |
2 files changed, 4 insertions, 18 deletions
diff --git a/apps/workflowengine/lib/Manager.php b/apps/workflowengine/lib/Manager.php index 674cfc65313..7d55cff446e 100644 --- a/apps/workflowengine/lib/Manager.php +++ b/apps/workflowengine/lib/Manager.php @@ -66,8 +66,6 @@ use OCP\WorkflowEngine\IEntityEvent; use OCP\WorkflowEngine\IManager; use OCP\WorkflowEngine\IOperation; use OCP\WorkflowEngine\IRuleMatcher; -use Symfony\Component\EventDispatcher\EventDispatcherInterface as LegacyDispatcher; -use Symfony\Component\EventDispatcher\GenericEvent; class Manager implements IManager { /** @var IStorage */ @@ -94,9 +92,6 @@ class Manager implements IManager { /** @var IL10N */ protected $l; - /** @var LegacyDispatcher */ - protected $legacyEventDispatcher; - /** @var IEntity[] */ protected $registeredEntities = []; @@ -126,7 +121,6 @@ class Manager implements IManager { IDBConnection $connection, IServerContainer $container, IL10N $l, - LegacyDispatcher $eventDispatcher, ILogger $logger, IUserSession $session, IEventDispatcher $dispatcher, @@ -136,7 +130,6 @@ class Manager implements IManager { $this->connection = $connection; $this->container = $container; $this->l = $l; - $this->legacyEventDispatcher = $eventDispatcher; $this->logger = $logger; $this->operationsByScope = new CappedMemoryCache(64); $this->session = $session; @@ -694,7 +687,6 @@ class Manager implements IManager { */ public function getEntitiesList(): array { $this->dispatcher->dispatchTyped(new RegisterEntitiesEvent($this)); - $this->legacyEventDispatcher->dispatch(IManager::EVENT_NAME_REG_ENTITY, new GenericEvent($this)); return array_values(array_merge($this->getBuildInEntities(), $this->registeredEntities)); } @@ -704,7 +696,6 @@ class Manager implements IManager { */ public function getOperatorList(): array { $this->dispatcher->dispatchTyped(new RegisterOperationsEvent($this)); - $this->legacyEventDispatcher->dispatch(IManager::EVENT_NAME_REG_OPERATION, new GenericEvent($this)); return array_merge($this->getBuildInOperators(), $this->registeredOperators); } @@ -714,7 +705,6 @@ class Manager implements IManager { */ public function getCheckList(): array { $this->dispatcher->dispatchTyped(new RegisterChecksEvent($this)); - $this->legacyEventDispatcher->dispatch(IManager::EVENT_NAME_REG_CHECK, new GenericEvent($this)); return array_merge($this->getBuildInChecks(), $this->registeredChecks); } diff --git a/apps/workflowengine/tests/ManagerTest.php b/apps/workflowengine/tests/ManagerTest.php index 543b4550ca6..dee6b508454 100644 --- a/apps/workflowengine/tests/ManagerTest.php +++ b/apps/workflowengine/tests/ManagerTest.php @@ -45,6 +45,7 @@ use OCP\IURLGenerator; use OCP\IUserManager; use OCP\IUserSession; use OCP\SystemTag\ISystemTagManager; +use OCP\WorkflowEngine\Events\RegisterEntitiesEvent; use OCP\WorkflowEngine\ICheck; use OCP\WorkflowEngine\IEntity; use OCP\WorkflowEngine\IEntityEvent; @@ -67,8 +68,6 @@ class ManagerTest extends TestCase { protected $db; /** @var \PHPUnit\Framework\MockObject\MockObject|ILogger */ protected $logger; - /** @var \PHPUnit\Framework\MockObject\MockObject|EventDispatcherInterface */ - protected $legacyDispatcher; /** @var MockObject|IServerContainer */ protected $container; /** @var MockObject|IUserSession */ @@ -94,7 +93,6 @@ class ManagerTest extends TestCase { return vsprintf($text, $parameters); }); - $this->legacyDispatcher = $this->createMock(EventDispatcherInterface::class); $this->logger = $this->createMock(ILogger::class); $this->session = $this->createMock(IUserSession::class); $this->dispatcher = $this->createMock(IEventDispatcher::class); @@ -105,7 +103,6 @@ class ManagerTest extends TestCase { \OC::$server->getDatabaseConnection(), $this->container, $this->l, - $this->legacyDispatcher, $this->logger, $this->session, $this->dispatcher, @@ -532,10 +529,9 @@ class ManagerTest extends TestCase { /** @var MockObject|IEntity $extraEntity */ $extraEntity = $this->createMock(IEntity::class); - $this->legacyDispatcher->expects($this->once()) - ->method('dispatch') - ->with('OCP\WorkflowEngine::registerEntities', $this->anything()) - ->willReturnCallback(function () use ($extraEntity) { + $this->dispatcher->expects($this->once()) + ->method('dispatchTyped') + ->willReturnCallback(function (RegisterEntitiesEvent $e) use ($extraEntity) { $this->manager->registerEntity($extraEntity); }); |