public function testProviderNotFoundException() { $this->setExpectedException('Exception', "Provider of type 'SpeedyJoe' not found.."); $input = dirname(__FILE__) . '/data/LoadFromFile.txt'; $options = array(); $factory = new Factory(); $provider = $factory->create('SpeedyJoe', $options); $provider->setProjectPath(dirname($input)); }
/** * Render view * * @param array $vars List of variables passed to text processors * * @return string */ public function render($vars = array()) { // inject front matter options into template $vars = array_merge($vars, $this->getParams()); // inject providers content if ($providers = $this->getParam('page.providers', false)) { $factory = new ProviderFactory(); $projectPath = new ProjectPath($this->getOutputDir()); foreach ($providers as $varname => $data) { if (!isset($data['provider'])) { continue; } $provider = $factory->create($data['provider'], $data); $provider->setProjectPath($projectPath->get()); $providedContent = $provider->get(); $vars['page']['providers'][$varname] = $providedContent; $vars['this']['providers'][$varname] = $providedContent; } } // convert view into static representation $view = $this->getTemplate(); foreach ($this->getProcessors() as $processor) { $view = $processor->render($view, $vars); } return $view; }