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

TestsBladeViews   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 5
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 12
rs 10
c 5
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A test() 0 7 2
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