public function testOnPermissionUpdateWrongType() { $event = new PermissionUpdateEvent(\stdClass::class, '1', null); $this->fileVersionMetaRepository->findByCollectionId(Argument::any())->shouldNotBeCalled(); $this->searchManager->deindex(Argument::any())->shouldNotBeCalled(); $this->permissionListener->onPermissionUpdate($event); }
public function onPermissionUpdate(PermissionUpdateEvent $permissionUpdateEvent) { if ($permissionUpdateEvent->getType() !== SecurityBehavior::class) { return; } $document = $this->documentManager->find($permissionUpdateEvent->getIdentifier()); $this->searchManager->deindex($document); }
/** * Schedules a document to be deindexed. * * @param RemoveEvent $event */ public function handlePreRemove(RemoveEvent $event) { $document = $event->getDocument(); if (!$document instanceof StructureBehavior) { return; } $this->searchManager->deindex($document); }
public function testHandlePreRemove() { $removeEvent = $this->prophesize(RemoveEvent::class); $document = $this->prophesize(StructureBehavior::class); $removeEvent->getDocument()->willReturn($document); $this->searchManager->deindex($document)->shouldBeCalled(); $this->subscriber->handlePreRemove($removeEvent->reveal()); }
/** * Removes all FileVersionMetas belonging to the collection, which just got secured. * * @param PermissionUpdateEvent $event */ public function onPermissionUpdate(PermissionUpdateEvent $event) { if ($event->getType() !== Collection::class) { return; } foreach ($this->fileVersionMetaRepository->findByCollectionId($event->getIdentifier()) as $fileVersionMeta) { $this->searchManager->deindex($fileVersionMeta); } }
/** * Deindexes the document from the search index for the website. * * @param UnpublishEvent $event */ public function deindexUnpublishedDocument(UnpublishEvent $event) { $document = $event->getDocument(); if (!$document instanceof StructureBehavior) { return; } $this->searchManager->deindex($document); }
public function testOnPermissionUpdateNotSecured() { $event = new PermissionUpdateEvent(\stdClass::class, '1', null); $this->searchManager->deindex(Argument::any())->shouldNotBeCalled(); $this->permissionListener->onPermissionUpdate($event); }