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 |
||
| 20 | View Code Duplication | class ConfTest4GetParseStatus extends \PHPUnit_Framework_TestCase |
|
| 21 | { |
||
| 22 | //------------------------------------------------------// |
||
| 23 | // テストメソッド定義 |
||
| 24 | //------------------------------------------------------// |
||
| 25 | /** |
||
| 26 | * setUp() |
||
| 27 | * |
||
| 28 | * テストに必要な準備を実施 |
||
| 29 | */ |
||
| 30 | protected function setUp() |
||
| 33 | |||
| 34 | /** |
||
| 35 | * test_GetParseStatus_BeforeParsed() |
||
| 36 | * |
||
| 37 | * 未パース時のGetParseStatus()の挙動をテストする |
||
| 38 | */ |
||
| 39 | public function test_GetParseStatus_BeforeParsed() |
||
| 45 | |||
| 46 | /** |
||
| 47 | * test_GetParseStatus_AfterParsed() |
||
| 48 | * |
||
| 49 | * パース後のGetParseStatus()の挙動をテストする |
||
| 50 | */ |
||
| 51 | public function test_GetParseStatus_AfterParsed() |
||
| 58 | } |
||
| 59 |