Browse Source

Added additional test for View::startIfEmpty($name)

Linus Probert 13 years ago
parent
commit
d6bf0dc003
1 changed files with 18 additions and 0 deletions
  1. 18 0
      lib/Cake/Test/Case/View/ViewTest.php

+ 18 - 0
lib/Cake/Test/Case/View/ViewTest.php

@@ -1235,6 +1235,24 @@ class ViewTest extends CakeTestCase {
 	}
 
 /**
+ * Test block with startIfEmpty
+ *
+ * @return void
+ */
+	public function testBlockCaptureStartStartIfEmpty() {
+		$this->View->start('test');
+		echo "Block content 1";
+		$this->View->end();
+
+		$this->View->startIfEmpty('test');
+		echo "Block content 2";
+		$this->View->end();
+
+		$result = $this->View->fetch('test');
+		$this->assertEquals('Block content 1', $result);
+	}
+
+/**
  * Test appending to a block with capturing output.
  *
  * @return void