1 | <?php |
||
17 | class RuleTest extends TestCase |
||
18 | { |
||
19 | /** |
||
20 | * @expectedException \LogicException |
||
21 | * @expectedExceptionMessage rule type is not defined |
||
22 | */ |
||
23 | public function testIvalidInitializationThrowAndException() |
||
27 | |||
28 | public function testContainsConfigurationAsArray() |
||
29 | { |
||
30 | $rule = Rule::fromArray( |
||
31 | $ruleConfiguration = [ |
||
32 | Rule::TYPE_OBJECT => [ |
||
33 | '\DateTime', |
||
34 | ] |
||
35 | ] |
||
36 | ); |
||
37 | |||
38 | $this->assertEquals( |
||
39 | $ruleConfiguration, |
||
40 | $rule->asArray() |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @expectedException \Sensorario\Resources\Exceptions\InvalidTypeException |
||
46 | * @expectedExceptionMessageRegex #Oops! Invalid configuration!!!Type `foo` is not valid.# |
||
47 | */ |
||
48 | public function testInvalidTypeIsNotAllowed() |
||
56 | |||
57 | public function testCheckFunctionReturnRuleValidityAsBoolean() |
||
68 | |||
69 | public function testCheckIfValueIsOfRightObjectType() |
||
83 | } |
||
84 |
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.