当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_View::getAllPaths方法代码示例

本文整理汇总了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);
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:37,代码来源:ViewTest.php

示例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));
     }
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:41,代码来源:ViewTest.php

示例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');
    }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:20,代码来源:ViewRendererTest.php


注:本文中的Zend_View::getAllPaths方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。