Permalink
Browse files

View::get() default param test

  • Loading branch information...
sime committed Sep 11, 2013
1 parent 0c3197a commit 50ad043092070a1598a6d1a80a40b4f6565e3ed7
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/Cake/Test/Case/View/ViewTest.php
@@ -1660,7 +1660,7 @@ public function testMemoryLeakInPaths() {
}
/**
- * Tests that a vew block uses default value when not assigned and uses assigned value when it is
+ * Tests that a view block uses default value when not assigned and uses assigned value when it is
*
* @return void
*/
@@ -1674,4 +1674,20 @@ public function testBlockDefaultValue() {
$result = $this->View->fetch('title', $default);
$this->assertEquals($expected, $result);
}
+
+/**
+ * Tests that a view variable uses default value when not assigned and uses assigned value when it is
+ *
+ * @return void
+ */
+ public function testViewVarDefaultValue() {
+ $default = 'Default';
+ $result = $this->View->get('title', $default);
+ $this->assertEquals($default, $result);
+
+ $expected = 'Back to the Future';
+ $this->View->set('title', $expected);
+ $result = $this->View->get('title', $default);
+ $this->assertEquals($expected, $result);
+ }
}

0 comments on commit 50ad043

Please sign in to comment.