1 | <?php |
||
23 | class GridFieldClearAllButtonTest extends SapphireTest |
||
24 | { |
||
25 | /** |
||
26 | * {@inheritDoc} |
||
27 | */ |
||
28 | protected $usesDatabase = true; |
||
29 | |||
30 | protected $gridField; |
||
31 | |||
32 | /** |
||
33 | * {@inheritDoc} |
||
34 | */ |
||
35 | public function setUp() |
||
48 | |||
49 | /** |
||
50 | * Return the actual class we're testing |
||
51 | * |
||
52 | * @return GridFieldClearAllButton |
||
53 | */ |
||
54 | protected function getSubject() |
||
58 | |||
59 | /** |
||
60 | * Ensure that the HTML fragment was pushed correctly and assigned to the specified fragment (in setUp above) |
||
61 | */ |
||
62 | public function testGetHtmlFragments() |
||
72 | |||
73 | /** |
||
74 | * Test that the GridFieldAction actions are returned correctly |
||
75 | */ |
||
76 | public function testActionsAreDefined() |
||
80 | |||
81 | /** |
||
82 | * Test that an exception is thrown if the Member doesn't have permission to delete the data class assigned |
||
83 | * |
||
84 | * @expectedException \SilverStripe\ORM\ValidationException |
||
85 | * @expectedExceptionMessage No permission to unlink record |
||
86 | */ |
||
87 | public function testCannotClearAllWithoutPermission() |
||
94 | |||
95 | /** |
||
96 | * Test that with permission the list can be cleared |
||
97 | */ |
||
98 | public function testClearList() |
||
108 | |||
109 | /** |
||
110 | * Create a set of dummy LogEntry records |
||
111 | * |
||
112 | * @param int $limit |
||
113 | */ |
||
114 | protected function createDummyLogs($limit = 5) |
||
129 | } |
||
130 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVar
assignment in line 1 and the$higher
assignment in line 2 are dead. The first because$myVar
is never used and the second because$higher
is always overwritten for every possible time line.