Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php |
||
| 16 | class CheckCommandTest extends \PHPUnit_Framework_TestCase |
||
| 17 | { |
||
| 18 | /** @var \PHPUnit_Framework_MockObject_MockObject|Command */ |
||
| 19 | private $command; |
||
| 20 | |||
| 21 | /** @var \PHPUnit_Framework_MockObject_MockObject|InputInterface */ |
||
| 22 | private $input; |
||
| 23 | |||
| 24 | /** @var \PHPUnit_Framework_MockObject_MockObject|OutputInterface */ |
||
| 25 | private $output; |
||
|
|
|||
| 26 | |||
| 27 | /** @var CheckCommand */ |
||
| 28 | private $sut; |
||
| 29 | |||
| 30 | protected function setUp() |
||
| 44 | |||
| 45 | View Code Duplication | public function testCheckCommandSuccessful() |
|
| 53 | |||
| 54 | View Code Duplication | public function testCheckCommandFailed() |
|
| 62 | |||
| 63 | public function testCheckWithPropertyOutput() |
||
| 79 | } |
||
| 80 |