コード例 #1
0
 /**
  * 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());
 }
コード例 #2
0
 /**
  * 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);
     }
 }