瀏覽代碼

[ZF-10284] Zend_View

- Added support fluent interface.



git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@22879 44c647ce-9c0f-0410-b52a-842ac1e357ba
ramon 15 年之前
父節點
當前提交
84994a808d
共有 2 個文件被更改,包括 11 次插入0 次删除
  1. 2 0
      library/Zend/View/Helper/HeadTitle.php
  2. 9 0
      tests/Zend/View/Helper/HeadTitleTest.php

+ 2 - 0
library/Zend/View/Helper/HeadTitle.php

@@ -104,7 +104,9 @@ class Zend_View_Helper_HeadTitle extends Zend_View_Helper_Placeholder_Container_
             require_once 'Zend/View/Exception.php';
             throw new Zend_View_Exception("You must use a valid attach order: 'PREPEND', 'APPEND' or 'SET'");
         }
+
         $this->_defaultAttachOrder = $setType;
+        return $this;
     }
 
     /**

+ 9 - 0
tests/Zend/View/Helper/HeadTitleTest.php

@@ -238,6 +238,15 @@ class Zend_View_Helper_HeadTitleTest extends PHPUnit_Framework_TestCase
         $placeholder = $this->helper->headTitle('Bar');
         $this->assertContains('BarFoo', $placeholder->toString());
     }
+
+    /**
+     * @group ZF-10284
+     */
+    public function testReturnTypeDefaultAttachOrder()
+    {
+        $this->assertTrue($this->helper->setDefaultAttachOrder('PREPEND') instanceof  Zend_View_Helper_HeadTitle);
+        $this->assertEquals('PREPEND', $this->helper->getDefaultAttachOrder());
+    }
 }
 
 // Call Zend_View_Helper_HeadTitleTest::main() if this source file is executed directly.