Passed
Push — master ( 5153a0...c7b3db )
by Josh
03:56
created

NovaLensTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 17
ccs 4
cts 4
cp 1
rs 10
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A novaLens() 0 7 2
1
<?php
2
3
namespace JoshGaber\NovaUnit\Lenses;
4
5
use Laravel\Nova\Lenses\Lens;
6
7
trait NovaLensTest
8
{
9
    /**
10
     * Initialize the Nova Action mock.
11
     *
12
     * @param string $lens The class path of the Lens
13
     * @param string $model The model used for making query assertions
14
     * @return MockLens The Lens mock instance
15
     * @throws InvalidNovaLensException If the supplied action class is not a Nova Lens
16
     */
17 2
    public static function novaLens(string $lens, string $model): MockLens
18
    {
19 2
        if (! \is_subclass_of($lens, Lens::class)) {
20 1
            throw new InvalidNovaLensException();
21
        }
22
23 1
        return new MockLens(new $lens(), $model);
24
    }
25
}
26