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 |
||
5 | class DebuggerTest extends PhpXmlRpc_LocalFileTestCase |
||
6 | { |
||
7 | public function setUp() |
||
8 | { |
||
9 | $this->args = argParser::getArgs(); |
||
10 | |||
11 | $this->baseUrl = $this->args['LOCALSERVER'] . str_replace( '/demo/server/server.php', '/debugger/', $this->args['URI'] ); |
||
12 | |||
13 | $this->coverageScriptUrl = 'http://' . $this->args['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] ); |
||
14 | } |
||
15 | |||
16 | public function testIndex() |
||
17 | { |
||
18 | $page = $this->request('index.php'); |
||
|
|||
19 | } |
||
20 | |||
21 | public function testController() |
||
24 | } |
||
25 | |||
26 | /** |
||
27 | * @todo test: |
||
28 | * - list methods |
||
29 | * - describe a method |
||
30 | * - execute a method |
||
31 | * - wrap a method |
||
32 | */ |
||
33 | public function testAction() |
||
36 | } |
||
37 | } |
||
38 |