コード例 #1
0
 /**
  * @param ManagerInterface $manager
  */
 public function visitManager(ManagerInterface $manager)
 {
     foreach ($this->elements as $element) {
         $this->factoryProductionLine->workOn($element);
         $manager->addElement($element);
     }
 }
コード例 #2
0
ファイル: ElementFactory.php プロジェクト: kbedn/admin-bundle
 /**
  * @param string $class
  * @return \FSi\Bundle\AdminBundle\Admin\Element
  * @throws \InvalidArgumentException
  */
 public function create($class)
 {
     $element = new $class();
     if (!$element instanceof Element) {
         throw new \InvalidArgumentException(sprintf("%s does not seems to be an admin element.", $class));
     }
     $this->productionLine->workOn($element);
     return $element;
 }
コード例 #3
0
 /**
  * @param \FSi\Bundle\AdminBundle\Admin\Manager $manager
  * @param \FSi\Bundle\AdminBundle\Factory\ProductionLine $productionLine
  * @param \FSi\Bundle\AdminBundle\Admin\Element $adminElement
  */
 function it_visit_manager_and_add_into_it_elements($manager, $productionLine, $adminElement)
 {
     $productionLine->workOn($adminElement)->shouldBeCalled();
     $manager->addElement($adminElement)->shouldBeCalled();
     $this->visitManager($manager);
 }
コード例 #4
0
 /**
  * @param \FSi\Bundle\AdminBundle\Factory\ProductionLine $productionLine
  */
 function it_create_admin_element($productionLine)
 {
     $productionLine->workOn(Argument::type('FSi\\Bundle\\AdminBundle\\Admin\\Element'))->shouldBeCalled();
     $this->create("FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\SimpleAdminElement")->shouldReturnAnInstanceOf("FSi\\Bundle\\AdminBundle\\spec\\fixtures\\Admin\\SimpleAdminElement");
 }