Skip to content

Commit

Permalink
Added test case for view block default value
Browse files Browse the repository at this point in the history
  • Loading branch information
tigrang committed Sep 18, 2012
1 parent 6d98069 commit f1a344e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion lib/Cake/Test/Case/View/ViewTest.php
Expand Up @@ -1445,4 +1445,20 @@ public function testMemoryLeakInPaths() {
$end = memory_get_usage(); $end = memory_get_usage();
$this->assertLessThanOrEqual($start + 5000, $end); $this->assertLessThanOrEqual($start + 5000, $end);
} }
}
/**
* tests that a vew block uses default value when not assigned and uses assigned value when it is
*
* @return void
*/
public function testBlockDefaultValue() {
$default = 'Default';
$result = $this->View->fetch('title', $default);
$this->assertEqual($result, $default);

$expected = 'My Title';
$this->View->assign('title', $expected);
$result = $this->View->fetch('title', $default);
$this->assertEqual($result, $expected);
}
}

0 comments on commit f1a344e

Please sign in to comment.