Passed
Push — master ( 0864ef...1ec4ca )
by Caen
03:40 queued 16s
created

TestsBladeViews::test()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 2
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Hyde\Testing;
6
7
use Illuminate\View\View;
8
use Hyde\Testing\Support\TestView;
9
10
/**
11
 * Provides a more fluent way to test Blade views.
12
 */
13
trait TestsBladeViews
14
{
15
    /**
16
     * Test a Blade view.
17
     */
18
    protected function test(string|View $view, $data = []): TestView
19
    {
20
        if ($view instanceof View) {
21
            return new TestView($view);
22
        }
23
24
        return new TestView(view($view, $data));
25
    }
26
}
27