MockActionElement   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 85
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
c 1
b 0
f 0
dl 0
loc 85
ccs 21
cts 21
cp 1
rs 10
wmc 7

7 Methods

Rating   Name   Duplication   Size   Complexity  
A assertShownOnIndex() 0 5 1
A assertShownOnDetail() 0 5 1
A assertHiddenFromTableRow() 0 5 1
A assertHiddenFromIndex() 0 5 1
A assertShownOnTableRow() 0 5 1
A __construct() 0 3 1
A assertHiddenFromDetail() 0 5 1
1
<?php
2
3
namespace JoshGaber\NovaUnit\Actions;
4
5
use Laravel\Nova\Actions\Action;
6
use PHPUnit\Framework\Assert as PHPUnit;
7
8
class MockActionElement
9
{
10
    private $action;
11
12 13
    public function __construct(Action $action)
13
    {
14 13
        $this->action = $action;
15 13
    }
16
17
    /**
18
     * Assert that the action can be shown on the index view.
19
     *
20
     * @param string $message
21
     * @return $this
22
     */
23 2
    public function assertShownOnIndex(string $message = ''): self
24
    {
25 2
        PHPUnit::assertTrue($this->action->showOnIndex, $message);
26
27 1
        return $this;
28
    }
29
30
    /**
31
     * Assert that the action is hidden from the index view.
32
     *
33
     * @param string $message
34
     * @return $this
35
     */
36 2
    public function assertHiddenFromIndex(string $message = ''): self
37
    {
38 2
        PHPUnit::assertFalse($this->action->showOnIndex, $message);
39
40 1
        return $this;
41
    }
42
43
    /**
44
     * Assert that the action can be shown on the detail view.
45
     *
46
     * @param string $message
47
     * @return $this
48
     */
49 2
    public function assertShownOnDetail(string $message = ''): self
50
    {
51 2
        PHPUnit::assertTrue($this->action->showOnDetail, $message);
52
53 1
        return $this;
54
    }
55
56
    /**
57
     * Assert that the action is hidden from the detail view.
58
     *
59
     * @param string $message
60
     * @return $this
61
     */
62 2
    public function assertHiddenFromDetail(string $message = ''): self
63
    {
64 2
        PHPUnit::assertFalse($this->action->showOnDetail, $message);
65
66 1
        return $this;
67
    }
68
69
    /**
70
     * Assert that the action can be shown on table rows.
71
     *
72
     * @param string $message
73
     * @return $this
74
     */
75 2
    public function assertShownOnTableRow(string $message = ''): self
76
    {
77 2
        PHPUnit::assertTrue($this->action->showOnTableRow, $message);
78
79 1
        return $this;
80
    }
81
82
    /**
83
     * Assert that the action is hidden from table rows.
84
     *
85
     * @param string $message
86
     * @return $this
87
     */
88 2
    public function assertHiddenFromTableRow(string $message = ''): self
89
    {
90 2
        PHPUnit::assertFalse($this->action->showOnTableRow, $message);
91
92 1
        return $this;
93
    }
94
}
95