Skip to content
This repository
Browse code

Added test case for view block default value

  • Loading branch information...
commit f1a344eee4b8bcfdba69ecc87fe09c86f7c87bd9 1 parent 6d98069
Tigran Gabrielyan authored September 13, 2012

Showing 1 changed file with 17 additions and 1 deletion. Show diff stats Hide diff stats

  1. 18  lib/Cake/Test/Case/View/ViewTest.php
18  lib/Cake/Test/Case/View/ViewTest.php
@@ -1445,4 +1445,20 @@ public function testMemoryLeakInPaths() {
1445 1445
 		$end = memory_get_usage();
1446 1446
 		$this->assertLessThanOrEqual($start + 5000, $end);
1447 1447
 	}
1448  
-}
  1448
+
  1449
+/**
  1450
+ * tests that a vew block uses default value when not assigned and uses assigned value when it is
  1451
+ *
  1452
+ * @return void
  1453
+ */
  1454
+	public function testBlockDefaultValue() {
  1455
+		$default = 'Default';
  1456
+		$result = $this->View->fetch('title', $default);
  1457
+		$this->assertEqual($result, $default);
  1458
+
  1459
+		$expected = 'My Title';
  1460
+		$this->View->assign('title', $expected);
  1461
+		$result = $this->View->fetch('title', $default);
  1462
+		$this->assertEqual($result, $expected);
  1463
+	}
  1464
+}

0 notes on commit f1a344e

Please sign in to comment.
Something went wrong with that request. Please try again.