Browse Source

correct constructor and write expectations

AD7six 12 years ago
parent
commit
2d573f50ae
2 changed files with 6 additions and 2 deletions
  1. 1 1
      src/View/StringTemplate.php
  2. 5 1
      tests/TestCase/View/StringTemplateTest.php

+ 1 - 1
src/View/StringTemplate.php

@@ -59,7 +59,7 @@ class StringTemplate {
  *
  * @param array $templates A set of templates to add.
  */
-	public function __construct(array $config = null) {
+	public function __construct(array $config = []) {
 		$this->config($config, null, true);
 	}
 

+ 5 - 1
tests/TestCase/View/StringTemplateTest.php

@@ -53,7 +53,11 @@ class StringTemplateTest extends TestCase {
 			'link' => '<a href="{{url}}">{{text}}</a>'
 		];
 		$result = $this->template->add($templates);
-		$this->assertNull($result, 'No return');
+		$this->assertSame(
+			$this->template,
+			$result,
+			'The same instance should be returned'
+		);
 
 		$this->assertEquals($templates['link'], $this->template->get('link'));
 	}