/** * @param string $id * @throws \Piece\Flow\PageFlow\FileNotFoundException */ public function add($id) { if (array_key_exists($id, $this->pageFlows)) { return; } $definitionFile = $this->pageFlowRegistries->getFileName($id); if (is_null($definitionFile)) { throw new FileNotFoundException(sprintf('The page flow definition file for the page flow ID "%s" is not found.', $id)); } $pageFlowCache = new PageFlowCache($definitionFile, $this->cacheDir, $this->clearCacheOnDestruction); if (!$pageFlowCache->isFresh()) { $pageFlowCache->write($this->pageFlowFactory->create($id)); } $this->pageFlows[$id] = $pageFlowCache; }
/** * @expectedException \Piece\Flow\PageFlow\ProtectedStateException * @since Method available since Release 1.2.0 * * @test */ public function raisesAnExceptionWhenThePageFlowDefinitionHasAProtectedState() { $this->pageFlowFactory->create('ProtectedState', \Phake::mock('Piece\\Flow\\PageFlow\\ActionInvokerInterface')); }