Conditions | 1 |
Paths | 1 |
Total Lines | 36 |
Code Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 2 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
18 | public function testShouldTriggerInitEvent(): void |
||
19 | { |
||
20 | $initTriggered = false; |
||
21 | |||
22 | // adding some listeners |
||
23 | $this->listenerProvider->attach(static function (BeforeRun $event) use (&$initTriggered) { |
||
24 | $initTriggered = true; |
||
25 | }); |
||
26 | |||
27 | ob_start(); |
||
28 | ob_implicit_flush(0); |
||
29 | |||
30 | ContentDecorator::begin() |
||
31 | ->viewFile($this->aliases->get('@view/layout.php')) |
||
32 | ->params([]) |
||
33 | ->init(); |
||
34 | |||
35 | echo "\t\t<div class='left-column'>\n"; |
||
36 | echo "\t\t\t<p>This is a left bar!</p>\n"; |
||
37 | echo "\t\t</div>\n\n"; |
||
38 | echo "\t\t<div class='right-column'>\n"; |
||
39 | echo "\t\t\t<p>This is a right bar!</p>\n"; |
||
40 | echo "\t\t</div>\n"; |
||
41 | |||
42 | ContentDecorator::end(); |
||
43 | |||
44 | $this->assertTrue($initTriggered); |
||
45 | |||
46 | $expected = "\t\t<div class='left-column'>\n" . |
||
47 | "\t\t\t<p>This is a left bar!</p>\n" . |
||
48 | "\t\t</div>\n\n" . |
||
49 | "\t\t<div class='right-column'>\n" . |
||
50 | "\t\t\t<p>This is a right bar!</p>\n" . |
||
51 | "\t\t</div>\n"; |
||
52 | |||
53 | $this->assertStringContainsString($expected, ob_get_clean()); |
||
54 | } |
||
56 |