View::get() default param test

This commit is contained in:
Simon Males 2013-09-11 22:22:50 +08:00
parent 0c3197a435
commit 50ad043092

View file

@ -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);
}
}