|
|
@@ -1128,49 +1128,50 @@ class ViewTest extends TestCase {
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testBlockCapture() {
|
|
|
+ public function testBlockCaptureOverwrite() {
|
|
|
$this->View->start('test');
|
|
|
echo 'Block content';
|
|
|
$this->View->end();
|
|
|
|
|
|
+ $this->View->start('test');
|
|
|
+ echo 'New content';
|
|
|
+ $this->View->end();
|
|
|
+
|
|
|
$result = $this->View->fetch('test');
|
|
|
- $this->assertEquals('Block content', $result);
|
|
|
+ $this->assertEquals('New content', $result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Test block with startIfEmpty
|
|
|
+ * Test that blocks can be fetched inside a block with the same name
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testBlockCaptureStartIfEmpty() {
|
|
|
- $this->View->startIfEmpty('test');
|
|
|
- echo "Block content 1";
|
|
|
+ public function testBlockExtend() {
|
|
|
+ $this->View->start('test');
|
|
|
+ echo 'Block content';
|
|
|
$this->View->end();
|
|
|
|
|
|
- $this->View->startIfEmpty('test');
|
|
|
- echo "Block content 2";
|
|
|
+ $this->View->start('test');
|
|
|
+ echo $this->View->fetch('test');
|
|
|
+ echo 'New content';
|
|
|
$this->View->end();
|
|
|
|
|
|
$result = $this->View->fetch('test');
|
|
|
- $this->assertEquals('Block content 1', $result);
|
|
|
+ $this->assertEquals('Block contentNew content', $result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * Test block with startIfEmpty
|
|
|
+ * Test creating a block with capturing output.
|
|
|
*
|
|
|
* @return void
|
|
|
*/
|
|
|
- public function testBlockCaptureStartStartIfEmpty() {
|
|
|
+ public function testBlockCapture() {
|
|
|
$this->View->start('test');
|
|
|
- echo "Block content 1";
|
|
|
- $this->View->end();
|
|
|
-
|
|
|
- $this->View->startIfEmpty('test');
|
|
|
- echo "Block content 2";
|
|
|
+ echo 'Block content';
|
|
|
$this->View->end();
|
|
|
|
|
|
$result = $this->View->fetch('test');
|
|
|
- $this->assertEquals('Block content 1', $result);
|
|
|
+ $this->assertEquals('Block content', $result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1183,9 +1184,7 @@ class ViewTest extends TestCase {
|
|
|
echo 'Block';
|
|
|
$this->View->end();
|
|
|
|
|
|
- $this->View->append('test');
|
|
|
- echo ' content';
|
|
|
- $this->View->end();
|
|
|
+ $this->View->append('test', ' content');
|
|
|
|
|
|
$result = $this->View->fetch('test');
|
|
|
$this->assertEquals('Block content', $result);
|