| Total Complexity | 6 |
| Total Lines | 49 |
| Duplicated Lines | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 14 | final class WidgetTest extends TestCase |
||
| 15 | { |
||
| 16 | public function testWidget(): void |
||
| 17 | { |
||
| 18 | $output = TestWidget::widget()->id('w0')->render(); |
||
| 19 | |||
| 20 | $this->assertSame('<run-w0>', $output); |
||
| 21 | } |
||
| 22 | |||
| 23 | public function testWidgetArrayConfig(): void |
||
| 24 | { |
||
| 25 | $output = TestWidget::widget(['id()' => ['w0']])->render(); |
||
| 26 | |||
| 27 | $this->assertSame('<run-w0>', $output); |
||
| 28 | } |
||
| 29 | |||
| 30 | public function testBeginEnd(): void |
||
| 31 | { |
||
| 32 | TestWidgetA::begin()->id('test'); |
||
| 33 | $output = TestWidgetA::end(); |
||
| 34 | |||
| 35 | $this->assertSame('<run-test>', $output); |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * @depends testBeginEnd |
||
| 40 | */ |
||
| 41 | public function testStackTracking(): void |
||
| 42 | { |
||
| 43 | $this->expectException(InvalidConfigException::class); |
||
| 44 | TestWidget::end(); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @depends testBeginEnd |
||
| 49 | */ |
||
| 50 | public function testStackTrackingDisorder(): void |
||
| 51 | { |
||
| 52 | $this->expectException(InvalidConfigException::class); |
||
| 53 | TestWidgetA::begin(); |
||
| 54 | TestWidgetB::begin(); |
||
| 55 | TestWidgetA::end(); |
||
| 56 | TestWidgetB::end(); |
||
| 57 | } |
||
| 58 | |||
| 59 | public function testInjection(): void |
||
| 60 | { |
||
| 61 | $widget = TestInjectionWidget::widget(); |
||
| 62 | $this->assertInstanceOf(Injectable::class, $widget->getInjectable()); |
||
| 63 | } |
||
| 65 |