1 | <?php |
||
6 | class DatabaseConnectionStringFactoryTest extends PHPUnit_Framework_TestCase |
||
7 | { |
||
8 | /** |
||
9 | * The instance of DatabaseConnectionStringFactory used in the test. |
||
10 | * |
||
11 | * @var Pyjac\ORM\DatabaseConnectionStringFactory |
||
12 | */ |
||
13 | protected $databaseConnectionStringFactory; |
||
14 | |||
15 | /** |
||
16 | * Configuration array. |
||
17 | * |
||
18 | * @var array |
||
19 | */ |
||
20 | protected $config; |
||
21 | |||
22 | protected function setUp() |
||
27 | |||
28 | public function testCreateDatabaseSourceStringReturnsCorrectPostgresDatabaseSourceString() |
||
34 | |||
35 | public function testCreateDatabaseSourceStringReturnsCorrectMYSqlDatabaseSourceString() |
||
41 | |||
42 | public function testCreateDatabaseSourceStringReturnsCorrectMYSqlDatabaseSourceStringWithPort() |
||
49 | |||
50 | public function testCreateDatabaseSourceStringReturnsCorrectSQLiteDatabaseSourceString() |
||
56 | |||
57 | /** |
||
58 | * @expectedException Pyjac\ORM\Exception\DatabaseDriverNotSupportedException |
||
59 | */ |
||
60 | public function testCreateDatabaseSourceStringThrowsDatabaseDriverNotSupportedExceptionWhenUnknownDriverIsPassed() |
||
65 | } |
||
66 |
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.