From 50ad043092070a1598a6d1a80a40b4f6565e3ed7 Mon Sep 17 00:00:00 2001 From: Simon Males Date: Wed, 11 Sep 2013 22:22:50 +0800 Subject: [PATCH] View::get() default param test --- lib/Cake/Test/Case/View/ViewTest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/View/ViewTest.php b/lib/Cake/Test/Case/View/ViewTest.php index 78a149bb0..fdf52d6e2 100644 --- a/lib/Cake/Test/Case/View/ViewTest.php +++ b/lib/Cake/Test/Case/View/ViewTest.php @@ -1660,7 +1660,7 @@ TEXT; } /** - * 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 @@ TEXT; $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); + } }