| Total Complexity | 4 |
| Total Lines | 46 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 15 | class WidgetTest extends TestCase |
||
| 16 | { |
||
| 17 | /** |
||
| 18 | * @var Widget $widget |
||
| 19 | */ |
||
| 20 | protected $widget; |
||
| 21 | |||
| 22 | public function testWidget(): void |
||
| 23 | { |
||
| 24 | $output = TestWidget::widget()->id('w0')->run(); |
||
| 25 | |||
| 26 | $this->assertSame('<run-w0>', $output); |
||
| 27 | } |
||
| 28 | |||
| 29 | public function testBeginEnd(): void |
||
| 30 | { |
||
| 31 | ob_start(); |
||
| 32 | ob_implicit_flush(0); |
||
| 33 | |||
| 34 | $widget = TestWidgetA::begin()->id('test'); |
||
| 35 | |||
| 36 | $this->assertInstanceOf(Widget::class, $widget); |
||
| 37 | |||
| 38 | TestWidgetA::end(); |
||
| 39 | $output = ob_get_clean(); |
||
| 40 | |||
| 41 | $this->assertSame('<run-test>', $output); |
||
| 42 | } |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @depends testBeginEnd |
||
| 46 | */ |
||
| 47 | public function testStackTracking(): void |
||
| 48 | { |
||
| 49 | $this->expectException('BadFunctionCallException'); |
||
| 50 | TestWidget::end(); |
||
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * @depends testBeginEnd |
||
| 55 | */ |
||
| 56 | public function testStackTrackingDisorder(): void |
||
| 61 | } |
||
| 62 | } |
||
| 63 |