/** * Sets up the fixture, for example, opens a network connection. * This method is called before a test is executed. * * @return void */ protected function setUp() { $coreConfig = new CoreConfig(); $coreConfig->setValue('stream_wrapper_is_active', 1); $this->object = new Partial($coreConfig); $coreConfig->setValue('stream_wrapper_is_active', 0); $this->view = ViewModel::fromArray(array('name' => 'View Name', 'identifier' => 'view-identifier', 'description' => 'View Description', 'content' => 'View Content')); $this->view->save(); $view = new View(); $templatePathStack = new TemplatePathStack(); $templatePathStack->addPath(GC_TEMPLATE_PATH); $view->setResolver($templatePathStack); $this->object->setView($view); }
/** * Test * * @return void */ public function testResolveWithFakePharProtocol() { $path = 'phar://' . __DIR__ . DIRECTORY_SEPARATOR . '_templates' . DIRECTORY_SEPARATOR . 'fake-view.phar'; $this->object->addPath($path); $markup = $this->object->resolve('hello.phtml'); $this->assertFalse($markup); }
/** * Create the template map view resolver * * Creates a Zend\View\Resolver\TemplatePathStack and populates it with the * ['view_manager']['template_path_stack'] and sets the default suffix with the * ['view_manager']['default_template_suffix'] * * @param ServiceLocatorInterface $serviceLocator Service Locator * * @return TemplatePathStack */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config'); $templatePathStack = new TemplatePathStack(); if (is_array($config) && isset($config['view_manager'])) { $config = $config['view_manager']; if (is_array($config)) { if (isset($config['template_path_stack'])) { $templatePathStack->addPaths($config['template_path_stack']); } if (isset($config['default_template_suffix'])) { $templatePathStack->setDefaultSuffix($config['default_template_suffix']); } } } return $templatePathStack; }