Skip to content

Commit ab7b3f7

Browse files
committed
Add a test that calls fetch() in a layout template
This ensures that #49 is actually fixed.
1 parent 1dd9a43 commit ab7b3f7

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

tests/PhpRendererTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function testLayout() {
125125

126126
$newResponse->getBody()->rewind();
127127

128-
$this->assertEquals("<html><head><title>Hello - My App</title></head><body>Hi</body></html>", $newResponse->getBody()->getContents());
128+
$this->assertEquals("<html><head><title>Hello - My App</title></head><body>Hi<footer>This is the footer</footer></body></html>", $newResponse->getBody()->getContents());
129129
}
130130

131131
public function testLayoutConstructor() {
@@ -139,7 +139,7 @@ public function testLayoutConstructor() {
139139

140140
$newResponse->getBody()->rewind();
141141

142-
$this->assertEquals("<html><head><title>Hello - My App</title></head><body>Hi</body></html>", $newResponse->getBody()->getContents());
142+
$this->assertEquals("<html><head><title>Hello - My App</title></head><body>Hi<footer>This is the footer</footer></body></html>", $newResponse->getBody()->getContents());
143143
}
144144

145145
public function testExceptionInLayout() {
@@ -198,6 +198,6 @@ public function testContentDataKeyShouldBeIgnored() {
198198

199199
$newResponse->getBody()->rewind();
200200

201-
$this->assertEquals("<html><head><title>Hello - My App</title></head><body>Hi</body></html>", $newResponse->getBody()->getContents());
201+
$this->assertEquals("<html><head><title>Hello - My App</title></head><body>Hi<footer>This is the footer</footer></body></html>", $newResponse->getBody()->getContents());
202202
}
203203
}

tests/_files/footer.phtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php echo '<footer>This is the footer</footer>';

tests/_files/layout.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<html><head><title><?=$title?></title></head><body><?=$content?></body></html>
1+
<html><head><title><?=$title?></title></head><body><?=$content?><?= $this->fetch('footer.phtml'); ?></body></html>

0 commit comments

Comments
 (0)