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 |
||
| 18 | class OrbitaleCmsExtensionTest extends \PHPUnit_Framework_TestCase |
||
| 19 | { |
||
| 20 | /** |
||
| 21 | * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException |
||
| 22 | * @expectedExceptionMessage Page class must be a valid class extending Orbitale\Bundle\CmsBundle\Entity\Page. "inexistent_page_class" given. |
||
| 23 | */ |
||
| 24 | View Code Duplication | public function testInexistentPageClass() |
|
| 37 | |||
| 38 | /** |
||
| 39 | * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException |
||
| 40 | * @expectedExceptionMessage Category class must be a valid class extending Orbitale\Bundle\CmsBundle\Entity\Category. "inexistent_category_class" given. |
||
| 41 | */ |
||
| 42 | View Code Duplication | public function testInexistentCategoryClass() |
|
| 55 | |||
| 56 | /** |
||
| 57 | * @dataProvider provideConfiguration |
||
| 58 | * |
||
| 59 | * @param $config |
||
| 60 | * @param $expected |
||
| 61 | */ |
||
| 62 | View Code Duplication | public function testConfiguration($config, $expected) |
|
| 74 | |||
| 75 | /** |
||
| 76 | * @dataProvider provideConfiguration |
||
| 77 | * |
||
| 78 | * @param $config |
||
| 79 | * @param $expected |
||
| 80 | */ |
||
| 81 | View Code Duplication | public function testConfigurationSymfony2($config, $expected) |
|
| 93 | |||
| 94 | public function provideConfiguration() |
||
| 115 | } |
||
| 116 |