Ejemplo n.º 1
0
 /**
  * @group ZF-8177
  */
 public function testRegisterHelperShouldRegisterHelperWithView()
 {
     require_once dirname(__FILE__) . '/View/_stubs/HelperDir1/Stub1.php';
     $view = new Zend_View();
     $helper = new Foo_View_Helper_Stub1();
     $view->registerHelper($helper, 'stub1');
     $this->assertEquals($view->getHelper('stub1'), $helper);
     $this->assertEquals($view->stub1(), 'foo');
 }
Ejemplo n.º 2
0
    /**
     * Tests that a help can be loaded from the search path
     *
     */
    public function testLoadHelper()
    {
        $view = new Zend_View();

        $view->setHelperPath(
            array(
                dirname(__FILE__) . '/View/_stubs/HelperDir1',
                dirname(__FILE__) . '/View/_stubs/HelperDir2'
            )
        );

        $this->assertEquals('foo', $view->stub1());
        $this->assertEquals('bar', $view->stub2());

        // erase the paths to the helper stubs
        $view->setHelperPath(null);

        // verify that object handle of a stub was cache by calling it again
        // without its path in the helper search paths
        $this->assertEquals( 'foo', $view->stub1() );
    }