| Total Complexity | 3 |
| Total Lines | 22 |
| Duplicated Lines | 0 % |
| Changes | 6 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | trait TestsBladeViews |
||
| 14 | { |
||
| 15 | /** |
||
| 16 | * Test a Blade view. |
||
| 17 | */ |
||
| 18 | protected function test(string|View $view, $data = []): TestView |
||
| 19 | { |
||
| 20 | $data = array_merge($this->testViewData(), $data); |
||
| 21 | |||
| 22 | if ($view instanceof View) { |
||
| 23 | return new TestView($view->with($data)); |
||
| 24 | } |
||
| 25 | |||
| 26 | return new TestView(view($view, $data)); |
||
| 27 | } |
||
| 28 | |||
| 29 | /** |
||
| 30 | * Define any view data to pass to all views in the test. |
||
| 31 | */ |
||
| 32 | protected function testViewData(): array |
||
| 35 | } |
||
| 36 | } |
||
| 37 |