1 | <?php |
||
7 | class MigrationTest extends \PHPUnit\Framework\TestCase |
||
8 | { |
||
9 | /** |
||
10 | * @var Migration |
||
11 | */ |
||
12 | protected $object; |
||
13 | |||
14 | public function setUp() |
||
18 | |||
19 | public function tearDown() |
||
23 | |||
24 | public function testGetBaseSql() |
||
29 | |||
30 | /** |
||
31 | * @expectedException \ByJG\DbMigration\Exception\InvalidMigrationFile |
||
32 | */ |
||
33 | public function testGetBaseSqlNotFound() |
||
38 | |||
39 | public function testGetBaseSqlNotFoundAndNotRequired() |
||
45 | |||
46 | public function testGetMigrationSql1() |
||
51 | |||
52 | public function testGetMigrationSql2() |
||
57 | |||
58 | public function testGetMigrationSql3() |
||
63 | |||
64 | /** |
||
65 | * @expectedException \ByJG\DbMigration\Exception\InvalidMigrationFile |
||
66 | * @expectedExceptionMessage version number '13' |
||
67 | */ |
||
68 | public function testGetMigrationSql4() |
||
72 | |||
73 | public function testGetMigrationSqlDown1() |
||
78 | |||
79 | public function testGetMigrationSqlDown2() |
||
84 | |||
85 | public function testGetMigrationSqlDown3() |
||
90 | |||
91 | /** |
||
92 | * @expectedException \ByJG\DbMigration\Exception\InvalidMigrationFile |
||
93 | * @expectedExceptionMessage version number '13' |
||
94 | */ |
||
95 | public function testGetMigrationSqlDown4() |
||
99 | } |
||
100 |
PHP Analyzer performs a side-effects analysis of your code. A side-effect is basically anything that might be visible after the scope of the method is left.
Let’s take a look at an example:
If we look at the
getEmail()
method, we can see that it has no side-effect. Whether you call this method or not, no future calls to other methods are affected by this. As such code as the following is useless:On the hand, if we look at the
setEmail()
, this method _has_ side-effects. In the following case, we could not remove the method call: