public function setUp() { $view = new View(); $base = str_replace('/', DIRECTORY_SEPARATOR, '/../_templates'); $view->resolver()->addPath(__DIR__ . $base); $view->vars()->setStrictVars(true); $this->view = $view; }
/** * Sets up the fixture, for example, open a network connection. * This method is called before a test is executed. * * @access protected */ protected function setUp() { $view = new View(); $view->resolver()->addPath(__DIR__ . '/_files/scripts'); Helper\PaginationControl::setDefaultViewPartial(null); $this->_viewHelper = new Helper\PaginationControl(); $this->_viewHelper->setView($view); $this->_paginator = Paginator\Paginator::factory(range(1, 101)); }
/** * @group ZF-5174 */ public function testPartialLoopPartialCounterResets() { $data = array(array('message' => 'foo'), array('message' => 'bar'), array('message' => 'baz'), array('message' => 'bat')); $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $result = $this->helper->__invoke('partialLoopCouter.phtml', $data); foreach ($data as $key => $item) { $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1); $this->assertContains($string, $result); } $result = $this->helper->__invoke('partialLoopCouter.phtml', $data); foreach ($data as $key => $item) { $string = 'This is an iteration: ' . $item['message'] . ', pointer at ' . ($key + 1); $this->assertContains($string, $result); } }
public function getView() { $view = new View(); $view->resolver()->addPath(__DIR__ . '/../TestAsset/views/'); return $view; }
public function testRendersWithPartial() { $view = new View\PhpRenderer(); $view->resolver()->addPath(__DIR__ . '/_files/scripts'); Helper\PaginationControl::setDefaultViewPartial('partial.phtml'); $this->_paginator->setView($view); $string = $this->_paginator->__toString(); $this->assertEquals('partial rendered successfully', $string); }
/** * Prepares the environment before running a test * */ protected function setUp() { $cwd = __DIR__; // read navigation config $this->_files = $cwd . '/_files'; $config = new XmlConfig($this->_files . '/navigation.xml'); // setup containers from config $this->_nav1 = new Navigation($config->get('nav_test1')); $this->_nav2 = new Navigation($config->get('nav_test2')); // setup view $view = new PhpRenderer(); $view->resolver()->addPath($cwd . '/_files/mvc/views'); // create helper $this->_helper = new $this->_helperName(); $this->_helper->setView($view); // set nav1 in helper as default $this->_helper->setContainer($this->_nav1); }
public function testObjectModelSetInObjectKeyWhenKeyPresent() { $this->helper->setObjectKey('foo'); $model = new \stdClass(); $model->footest = 'bar'; $model->bartest = 'baz'; $view = new View(); $view->resolver()->addPath($this->basePath . '/application/views/scripts'); $this->helper->setView($view); $return = $this->helper->direct('partialObj.phtml', $model); $this->assertNotContains('No object model passed', $return); foreach (get_object_vars($model) as $key => $value) { $string = sprintf('%s: %s', $key, $value); $this->assertContains($string, $return, "Checking for '{$return}' containing '{$string}'"); } }