NovaActionTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A novaAction() 0 7 2
1
<?php
2
3
namespace JoshGaber\NovaUnit\Actions;
4
5
use Laravel\Nova\Actions\Action;
6
7
trait NovaActionTest
8
{
9
    /**
10
     * Initialize the Nova Action mock.
11
     *
12
     * @param string $action The class path of the Action
13
     * @return MockAction The Action mock instance
14
     * @throws InvalidNovaActionException If the supplied action class is not a Nova Action
15
     */
16 2
    public static function novaAction(string $action): MockAction
17
    {
18 2
        if (! \is_subclass_of($action, Action::class)) {
19 1
            throw new InvalidNovaActionException('The class provided is not a valid Nova Action.');
20
        }
21
22 1
        return new MockAction(new $action());
23
    }
24
}
25