| Conditions | 2 |
| Paths | 2 |
| Total Lines | 38 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function testSiblings() |
||
| 19 | { |
||
| 20 | $uni1 = $this->getUnitMock('tst1'); |
||
| 21 | $uni2 = $this->getUnitMock('tst2'); |
||
| 22 | $uni3 = $this->getUnitMock('tst3'); |
||
| 23 | $uni4 = $this->getUnitMock('tst4'); |
||
| 24 | $uni5 = $this->getUnitMock('tst5'); |
||
| 25 | $uni6 = $this->getUnitMock('tst6'); |
||
| 26 | $uni7 = $this->getUnitMock('tst7'); |
||
| 27 | $uni8 = $this->getUnitMock('tst8'); // orphan on purpose :) |
||
|
|
|||
| 28 | $uni9 = $this->getUnitMock('tst9'); |
||
| 29 | |||
| 30 | $uni1->addSibling($uni2); |
||
| 31 | $uni1->addSibling($uni3); |
||
| 32 | $uni1->addSibling($uni4); |
||
| 33 | $uni1->addSibling($uni5); |
||
| 34 | $uni5->addSibling($uni6); |
||
| 35 | $uni6->addSibling($uni7); |
||
| 36 | $uni7->addSibling($uni9); |
||
| 37 | |||
| 38 | $siblings = [ |
||
| 39 | 'tst1' => $uni1, |
||
| 40 | 'tst2' => $uni2, |
||
| 41 | 'tst3' => $uni3, |
||
| 42 | 'tst4' => $uni4, |
||
| 43 | 'tst5' => $uni5, |
||
| 44 | 'tst6' => $uni6, |
||
| 45 | 'tst7' => $uni7, |
||
| 46 | 'tst9' => $uni9, |
||
| 47 | ]; |
||
| 48 | |||
| 49 | /** @var AbstractUnit $unit */ |
||
| 50 | foreach ($siblings as $unit) { |
||
| 51 | $toCompare = $siblings; |
||
| 52 | unset($toCompare[$unit->getCode()]); |
||
| 53 | $this->assertEquals($toCompare, $unit->getSiblings()); |
||
| 54 | } |
||
| 55 | } |
||
| 56 | } |
||
| 57 |
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently.
Both the
$myVarassignment in line 1 and the$higherassignment in line 2 are dead. The first because$myVaris never used and the second because$higheris always overwritten for every possible time line.