public function setUp() { $this->container = new \Pimple(); $this->extension = new CarewExtension($this->container); $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(array(__DIR__ . '/fixtures/theme1', __DIR__ . '/fixtures/theme2', __DIR__ . '/../../Twig/Resources/layouts'))); $documents = array(); for ($i = 1; $i <= 20; ++$i) { $document = new Document(); $document->setTitle('Doc #' . $i); $document->setTags('Tag #' . $i % 5); $document->setFilePath('pages/page-' . $i); $document->setPath('pages/page-' . $i . '.html'); $documents[$document->getFilePath()] = $document; } $processor = new Processor(); $this->globals = $processor->processGlobals($documents); $this->documents = $documents; $this->twig->addGlobal('carew', $this->globals); $this->twig->addExtension($this->extension); }