public function testInitView() { Controller\Front::getInstance()->setControllerDirectory(__DIR__ . DIRECTORY_SEPARATOR . '_files'); require_once __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ViewController.php'; $controller = new \ViewController(new Request\Http(), new Response\Cli()); $view = $controller->initView(); $this->assertTrue($view instanceof \Zend\View\View); $scriptPath = $view->getScriptPaths(); $this->assertTrue(is_array($scriptPath)); $this->assertEquals(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'scripts/', $scriptPath[0]); }
public function testInitView() { Zend_Controller_Front::getInstance()->setControllerDirectory(dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files'); require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ViewController.php'; $controller = new ViewController(new Zend_Controller_Request_Http(), new Zend_Controller_Response_Cli()); $view = $controller->initView(); $this->assertTrue($view instanceof Zend_View); $scriptPath = $view->getScriptPaths(); $this->assertTrue(is_array($scriptPath)); $this->assertEquals(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR, $scriptPath[0]); }
public function testInitView() { Controller\Front::getInstance()->setControllerDirectory(__DIR__ . DIRECTORY_SEPARATOR . '_files'); require_once __DIR__ . DIRECTORY_SEPARATOR . '_files' . DIRECTORY_SEPARATOR . 'ViewController.php'; $controller = new \ViewController(new Request\Http(), new Response\Cli()); $view = $controller->initView(); $this->assertTrue($view instanceof \Zend\View\Renderer); $scriptPath = $view->resolver()->getPaths(); $found = false; $expected = new \SplFileInfo(__DIR__ . '/views/scripts/'); foreach ($scriptPath as $path) { if (rtrim($path, DIRECTORY_SEPARATOR) == $expected->getPathname()) { $found = true; } } $this->assertTrue($found); }