Browse Source

change proxied config function to return the helper

On write options to modify templates - return $this instead of the
templater object
AD7six 12 years ago
parent
commit
c754f12590

+ 2 - 1
src/View/Helper/StringTemplateTrait.php

@@ -41,7 +41,8 @@ trait StringTemplateTrait {
 			return $this->templater()->get($templates);
 		}
 
-		return $this->templater()->add($templates);
+		$this->templater()->add($templates);
+		return $this;
 	}
 
 /**

+ 6 - 1
tests/TestCase/View/Helper/PaginatorHelperTest.php

@@ -83,7 +83,12 @@ class PaginatorHelperTest extends TestCase {
 		$result = $this->Paginator->templates([
 			'test' => 'val'
 		]);
-		$this->assertNull($result, 'Setting should return null');
+		$this->assertSame(
+			$this->Paginator,
+			$result,
+			'Setting should return the same object'
+		);
+
 		$result = $this->Paginator->templates();
 		$this->assertArrayHasKey('test', $result);
 		$this->assertEquals('val', $result['test']);