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 |
||
| 3 | namespace Dynamic\DynamicBlocks\Test; |
||
| 4 | |||
| 5 | use Dynamic\DynamicBlocks\ORM\DynamicContentBlockDataExtension; |
||
| 6 | use SilverStripe\Forms\FieldList; |
||
| 7 | use SilverStripe\ORM\DataExtension; |
||
| 8 | |||
| 9 | class BlocksSlideImageDataExtensionTest extends DataExtension |
||
| 10 | { |
||
| 11 | /** |
||
| 12 | * @var string |
||
| 13 | */ |
||
| 14 | protected static $fixture_file = 'dynamic-blocks/tests/Fixtures.yml'; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * |
||
| 18 | */ |
||
| 19 | public function testGetCMSFields() |
||
| 20 | { |
||
| 21 | $object = $this->objFromFixture('SlideImage', 'one'); |
||
|
|
|||
| 22 | $fields = $object->getCMSFields(); |
||
| 23 | $extension = new DynamicContentBlockDataExtension(); |
||
| 24 | $extension->updateCMSFields($fields); |
||
| 29 | } |
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.