/** * Called on the preRemove event. * * @param LifecycleEventArgs $eventArgs */ public function preRemove(LifecycleEventArgs $eventArgs) { $object = $eventArgs->getObject(); // only handle our model if (!$object instanceof Group) { return; } $this->groupService->removeOptionsFor($object->getRoleName()); }
/** * Tests that options can be removed. */ public function testRemoval() { $this->groupService->setOptionsFor('ADMIN', $this->optionData['admin']); $options = $this->groupService->getOptionsFor('ADMIN'); $this->assertEquals($this->optionData['admin'], $options); $this->groupService->removeOptionsFor('ADMIN'); try { $this->groupService->getOptionsFor('ADMIN'); $this->fail(); } catch (\Exception $e) { $this->assertTrue(true); } }