| Total Complexity | 1 |
| Total Lines | 32 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 12 | final class ContentDecoratorTest extends TestCase |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * {@see https://github.com/yiisoft/yii2/issues/15536} |
||
| 16 | */ |
||
| 17 | public function testContentDecorator(): void |
||
| 18 | { |
||
| 19 | ob_start(); |
||
| 20 | ob_implicit_flush(0); |
||
| 21 | |||
| 22 | ContentDecorator::begin() |
||
| 23 | ->viewFile($this->aliases->get('@view/layout.php')) |
||
| 24 | ->params([]) |
||
| 25 | ->start(); |
||
| 26 | |||
| 27 | echo "\t\t<div class='left-column'>\n"; |
||
| 28 | echo "\t\t\t<p>This is a left bar!</p>\n"; |
||
| 29 | echo "\t\t</div>\n\n"; |
||
| 30 | echo "\t\t<div class='right-column'>\n"; |
||
| 31 | echo "\t\t\t<p>This is a right bar!</p>\n"; |
||
| 32 | echo "\t\t</div>\n"; |
||
| 33 | |||
| 34 | echo ContentDecorator::end(); |
||
| 35 | |||
| 36 | $expected = "\t\t<div class='left-column'>\n" . |
||
| 37 | "\t\t\t<p>This is a left bar!</p>\n" . |
||
| 38 | "\t\t</div>\n\n" . |
||
| 39 | "\t\t<div class='right-column'>\n" . |
||
| 40 | "\t\t\t<p>This is a right bar!</p>\n" . |
||
| 41 | "\t\t</div>\n"; |
||
| 42 | |||
| 43 | $this->assertStringContainsString($expected, ob_get_clean()); |
||
| 44 | } |
||
| 46 |