Exemplo n.º 1
0
 public function testProviderNotFoundException()
 {
     $this->setExpectedException('RuntimeException', "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));
 }
Exemplo n.º 2
0
 /**
  * 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_recursive($vars, $this->getParams());
     // inject providers content
     if ($providers = $this->getParam('page.providers', false)) {
         $factory = new ProviderFactory();
         foreach ($providers as $varname => $data) {
             if (!isset($data['provider'])) {
                 continue;
             }
             $provider = $factory->create($data['provider'], $data);
             $provider->setProjectPath($this->getInputRootDir());
             $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;
 }