public function testGetStringAction() { $action = new ShowAction(); $pool = new ActionPool(); $pool->addAction($action); $factory = new ActionFactory($pool); $this->assertInstanceOf('Vardius\\Bundle\\CrudBundle\\Actions\\Action\\ShowAction', $factory->get($action->getName())); }
/** * @param $action * @param array $options * @return Action */ public function get($action, array $options = []) { if (is_string($action)) { $action = $this->actionPool->getAction($action); } if (!$action instanceof Action) { throw new \InvalidArgumentException('The $action mast be instance of Action. ' . $action . ' given'); } $action = clone $action; $action->setOptions($options); return $action; }