Ejemplo n.º 1
0
 /**
  * @group ZF-6087
  */
 public function testConstructorShouldAllowPassingArrayOfFilterPaths()
 {
     $view = new Zend_View(array('filterPath' => array('My_View' => 'My/View/')));
     $paths = $view->getFilterPaths();
     $this->assertTrue(array_key_exists('My_View_', $paths), var_export($paths, 1));
 }
Ejemplo n.º 2
0
 protected function _testBasePath(Zend_View $view, $base)
 {
     $scriptPaths = $view->getScriptPaths();
     $helperPaths = $view->getHelperPaths();
     $filterPaths = $view->getFilterPaths();
     $this->assertContains($base . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR, $scriptPaths);
     $found = false;
     foreach ($helperPaths as $path) {
         if ($path['dir'] == $base . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, var_export($helperPaths, 1));
     $found = false;
     foreach ($filterPaths as $path) {
         if ($path['dir'] == $base . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR) {
             $found = true;
             break;
         }
     }
     $this->assertTrue($found, var_export($filterPaths, 1));
 }
Ejemplo n.º 3
0
    protected function _testBasePath(Zend_View $view, $base, $classPrefix = null)
    {
        $scriptPaths = $view->getScriptPaths();
        $helperPaths = $view->getHelperPaths();
        $filterPaths = $view->getFilterPaths();
        $this->assertContains($base . DIRECTORY_SEPARATOR . 'scripts' . DIRECTORY_SEPARATOR, $scriptPaths);

        $found  = false;
        $prefix = false;
        foreach ($helperPaths as $path) {
            if ($path['dir'] == $base . DIRECTORY_SEPARATOR . 'helpers' . DIRECTORY_SEPARATOR) {
                $found  = true;
                $prefix = $path['prefix'];
                break;
            }
        }
        $this->assertTrue($found, var_export($helperPaths, 1));
        if (null !== $classPrefix) {
            $this->assertTrue($prefix !== false);
            $this->assertEquals($classPrefix . '_Helper_', $prefix);
        }

        $found  = false;
        $prefix = false;
        foreach ($filterPaths as $path) {
            if ($path['dir'] == $base . DIRECTORY_SEPARATOR . 'filters' . DIRECTORY_SEPARATOR) {
                $found  = true;
                $prefix = $path['prefix'];
                break;
            }
        }
        $this->assertTrue($found, var_export($filterPaths, 1));
        if (null !== $classPrefix) {
            $this->assertTrue($prefix !== false);
            $this->assertEquals($classPrefix . '_Filter_', $prefix);
        }
    }
Ejemplo n.º 4
0
 public function testSetConfigInConstructor()
 {
     $scriptPath = $this->normalizePath(dirname(__FILE__) . '/View/_templates/');
     $helperPath = $this->normalizePath(dirname(__FILE__) . '/View/_stubs/HelperDir1/');
     $filterPath = $this->normalizePath(dirname(__FILE__) . '/View/_stubs/HelperDir1/');
     $config = array('escape' => 'strip_tags', 'encoding' => 'UTF-8', 'scriptPath' => $scriptPath, 'helperPath' => $helperPath, 'filterPath' => $filterPath, 'filter' => 'urlencode');
     $view = new Zend_View($config);
     $scriptPaths = $view->getScriptPaths();
     $helperPaths = $view->getHelperPaths();
     $filterPaths = $view->getFilterPaths();
     $this->assertContains($this->normalizePath($scriptPath), $scriptPaths);
     $found = false;
     foreach ($helperPaths as $pathInfo) {
         if (strstr($pathInfo['dir'], $helperPath)) {
             $found = true;
         }
     }
     $this->assertTrue($found, var_export($helperPaths, 1));
     $found = false;
     foreach ($filterPaths as $pathInfo) {
         if (strstr($pathInfo['dir'], $filterPath)) {
             $found = true;
         }
     }
     $this->assertTrue($found, var_export($filterPaths, 1));
 }