MockActionElement::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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