These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\ArticleBundle\Tests\Form; |
||
4 | |||
5 | use Kunstmaan\ArticleBundle\Form\AbstractArticleOverviewPageAdminType; |
||
6 | use Kunstmaan\ArticleBundle\Form\AbstractArticlePageAdminType; |
||
7 | use PHPUnit\Framework\TestCase; |
||
8 | use Symfony\Component\Form\FormBuilder; |
||
9 | use Symfony\Component\OptionsResolver\OptionsResolver; |
||
10 | |||
11 | /** |
||
12 | * Class AbstractArticleOverviewPageAdminTypeTest |
||
13 | */ |
||
14 | View Code Duplication | class AbstractArticleOverviewPageAdminTypeTest extends TestCase |
|
0 ignored issues
–
show
|
|||
15 | { |
||
16 | /** |
||
17 | * @var AbstractArticlePageAdminType |
||
18 | */ |
||
19 | private $object; |
||
20 | |||
21 | public function setUp() |
||
22 | { |
||
23 | $entity = new AbstractArticleOverviewPageAdminType(); |
||
24 | $this->object = $entity; |
||
25 | } |
||
26 | |||
27 | public function testBlockPrefix() |
||
28 | { |
||
29 | $this->assertEquals('AbstractArticleOverviewPage', $this->object->getBlockPrefix()); |
||
30 | } |
||
31 | |||
32 | public function testConfigureOptions() |
||
33 | { |
||
34 | $resolver = new OptionsResolver(); |
||
35 | $this->object->configureOptions($resolver); |
||
36 | $this->assertTrue($resolver->hasDefault('data_class')); |
||
37 | } |
||
38 | |||
39 | public function testBuildForm() |
||
40 | { |
||
41 | $builder = $this->createMock(FormBuilder::class); |
||
42 | $builder->expects($this->exactly(3))->method('add')->willReturn($builder); |
||
43 | |||
44 | /* @var FormBuilder $builder */ |
||
45 | $this->object->buildForm($builder, []); |
||
46 | } |
||
47 | } |
||
48 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.