1 | <?php |
||
18 | class ChangeGroupsCommandTest extends AbstractCommandTest |
||
19 | { |
||
20 | /** |
||
21 | * Ensure a clean slate for each test run |
||
22 | * |
||
23 | * {@inheritDoc} |
||
24 | */ |
||
25 | public function setUp() |
||
30 | |||
31 | /** |
||
32 | * {@inheritDoc} |
||
33 | */ |
||
34 | public function getTestCommand() |
||
38 | |||
39 | /** |
||
40 | * Test that an error message is returned if the Member does not exist |
||
41 | * |
||
42 | * @covers ::execute |
||
43 | */ |
||
44 | public function testReportMemberNotFound() |
||
49 | |||
50 | /** |
||
51 | * Test that when a Group is chosen from the multiselect list, the user is assigned to that Group or Groups |
||
52 | * |
||
53 | * @covers ::execute |
||
54 | */ |
||
55 | public function testAddToGroups() |
||
71 | |||
72 | /** |
||
73 | * Creates a dummy user for testing with |
||
74 | * |
||
75 | * @return Member |
||
76 | */ |
||
77 | protected function createMember() |
||
85 | |||
86 | /** |
||
87 | * Mock a QuestionHelper and tell it to return a predefined choice for which Group to assign |
||
88 | * |
||
89 | * @return QuestionHelper |
||
90 | */ |
||
91 | protected function mockQuestionHelper() |
||
116 | } |
||
117 |
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.