/**
  * @covers Columnis\Model\Template::getDefinedAssets
  * @covers Columnis\Model\Template::searchAssets
  */
 public function testGetAssets()
 {
     $template = new Template();
     $path = $this->getExampleTemplatePath();
     $template->setPath($path);
     $name = 'example-template';
     $template->setName($name);
     $extensions = array('css', 'js');
     $extension = $extensions[array_rand($extensions)];
     $searchAssets = array('css' => array(realpath($path . DIRECTORY_SEPARATOR . 'css/example.css'), realpath($path . DIRECTORY_SEPARATOR . 'css/example2.css')), 'js' => array(realpath($path . DIRECTORY_SEPARATOR . 'js/example.js')));
     $definedAssets = array('css' => array(realpath(Bootstrap::getTestFilesDir() . 'public.dist/css/jquery-ui.css')), 'js' => array(realpath(Bootstrap::getTestFilesDir() . 'public.dist/js/jquery-1.8.2.min.js')));
     $expectedDefinedAssets = $definedAssets[$extension];
     $expectedSearchAssets = $searchAssets[$extension];
     sort($expectedSearchAssets);
     $expectedAssets = array_merge($expectedDefinedAssets, $expectedSearchAssets);
     $this->assertEquals($expectedAssets, $template->getAssets($extension));
 }
 /**
  * Generates the collection of the template assets by iterating over the assets
  * in the template directory and adds it to the Resolver
  *
  * @param string $alias
  */
 public function loadTemplateCollection($alias)
 {
     $templateName = $this->matchTemplateName($alias);
     if ($templateName !== false) {
         $path = $this->getExistantTemplatePath($templateName);
         if ($path !== null) {
             $template = new Template();
             $template->setName($templateName);
             $template->setPath($path);
             $extension = pathinfo($alias, PATHINFO_EXTENSION);
             $files = $template->getAssets($extension);
             $this->addToCollections($alias, $files);
         }
     }
 }
 /**
  * Creats a Template instance from an array with page Data.
  *
  * @param array $data
  * @throws TemplateNameNotSetException
  * @return Template
  */
 public function createFromData(array $data)
 {
     if (isset($data['template']) && !empty($data['template'])) {
         $templateName = $data['template'];
     } else {
         throw new TemplateNameNotSetException("Template not set in page response.");
     }
     if (isset($data['template_path']) && !empty($data['template_path'])) {
         $path = $data['template_path'];
     } else {
         $path = $this->getExistantTemplatePath($templateName);
     }
     $template = new Template();
     $template->setName($templateName);
     $template->setPath($path);
     return $template;
 }