本文整理汇总了PHP中Zend_View::getAllPaths方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_View::getAllPaths方法的具体用法?PHP Zend_View::getAllPaths怎么用?PHP Zend_View::getAllPaths使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_View
的用法示例。
在下文中一共展示了Zend_View::getAllPaths方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _testAddPath
/**
* Tests (script|helper|filter) paths can be added, that they are added
* in the proper order, and that directory separators are properly handled.
*
* @param string $pathType one of "script", "helper", or "filter".
*/
protected function _testAddPath($pathType)
{
$view = new Zend_View();
$prefix = 'Zend_View_' . ucfirst($pathType) . '_';
// introspect default paths and build expected results.
$reflector = $view->getAllPaths();
$expectedPaths = $reflector[$pathType];
if ('script' == $pathType) {
array_unshift($expectedPaths, 'baz' . DIRECTORY_SEPARATOR);
array_unshift($expectedPaths, 'bar' . DIRECTORY_SEPARATOR);
array_unshift($expectedPaths, 'foo' . DIRECTORY_SEPARATOR);
} else {
array_unshift($expectedPaths, array('prefix' => $prefix, 'dir' => 'baz' . DIRECTORY_SEPARATOR));
array_unshift($expectedPaths, array('prefix' => $prefix, 'dir' => 'bar' . DIRECTORY_SEPARATOR));
array_unshift($expectedPaths, array('prefix' => $prefix, 'dir' => 'foo' . DIRECTORY_SEPARATOR));
}
// add paths
$func = 'add' . ucfirst($pathType) . 'Path';
$view->$func('baz'); // no separator
$view->$func('bar\\'); // windows
$view->$func('foo/'); // unix
// introspect script paths after adding two new paths
$reflector = $view->getAllPaths();
$actualPaths = $reflector[$pathType];
$this->assertSame($expectedPaths, $actualPaths);
}
示例2: _testAddPath
/**
* Tests (script|helper|filter) paths can be added, that they are added
* in the proper order, and that directory separators are properly handled.
*
* @param string $pathType one of "script", "helper", or "filter".
*/
protected function _testAddPath($pathType)
{
$view = new Zend_View();
$prefix = 'Zend_View_' . ucfirst($pathType) . '_';
// introspect default paths and build expected results.
$reflector = $view->getAllPaths();
$expectedPaths = $reflector[$pathType];
if ($pathType != 'script') {
$expectedPaths = $this->_filterPath($expectedPaths[$prefix]);
}
array_push($expectedPaths, 'baz');
array_push($expectedPaths, 'bar');
array_push($expectedPaths, 'foo');
// add paths
$func = 'add' . ucfirst($pathType) . 'Path';
$view->{$func}('baz');
// no separator
$view->{$func}('bar\\');
// windows
$view->{$func}('foo/');
// unix
// introspect script paths after adding two new paths
$reflector = $view->getAllPaths();
$actualPaths = $this->_filterPath($reflector[$pathType]);
switch ($pathType) {
case 'script':
$this->assertSame(array_reverse($expectedPaths), $actualPaths);
break;
case 'helper':
case 'filter':
default:
$this->assertTrue(array_key_exists($prefix, $actualPaths));
$this->assertSame($expectedPaths, $actualPaths[$prefix], 'Actual: ' . var_export($actualPaths, 1) . "\nExpected: " . var_export($expectedPaths, 1));
}
}
示例3: testStockInflectorWorksWithViewBaseSpec
/**
* @issue ZF-2443
*/
public function testStockInflectorWorksWithViewBaseSpec()
{
$this->request->setModuleName('bar') // bar must exist so the ViewRendere doesnt throw an exception
->setControllerName('index')
->setActionName('admin');
$controller = new Bar_IndexController($this->request, $this->response, array());
$this->helper->setActionController($controller);
$this->helper->setView($view = new Zend_View());
$this->helper->setViewBasePathSpec(':moduleDir/:module');
$this->helper->initView();
$viewScriptPaths = $view->getAllPaths();
$this->assertRegExp('#modules/bar/bar/scripts/$#', $viewScriptPaths['script'][0]);
$this->assertEquals($this->helper->getViewScript(), 'index/admin.phtml');
}