Completed
Push — master ( 3cd231...d48ef1 )
by
unknown
153:58 queued 132:33
created

TextFormSubmissionTypeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 5
dl 27
loc 27
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFormType() 24 24 2

How to fix   Duplicated Code   

Duplicated Code

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
2
3
namespace Kunstmaan\FormBundle\Tests\Form;
4
5
use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\TextFormSubmissionField;
6
use Kunstmaan\FormBundle\Form\TextFormSubmissionType;
7
use Symfony\Component\Form\Test\TypeTestCase;
8
9
/**
10
 * Class TextFormSubmissionTypeTest
11
 */
12 View Code Duplication
class TextFormSubmissionTypeTest extends TypeTestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
13
{
14
    public function testFormType()
15
    {
16
        $formData = [
17
            'value' => 'ball of string',
18
        ];
19
20
        $form = $this->factory->create(TextFormSubmissionType::class);
21
22
        $object = new TextFormSubmissionField();
23
        $object->setValue('ball of string');
24
25
        $form->submit($formData);
26
27
        $this->assertTrue($form->isSynchronized());
28
        $this->assertTrue($form->isValid());
29
        $this->assertEquals($object, $form->getData());
30
31
        $view = $form->createView();
32
        $children = $view->children;
33
34
        foreach (array_keys($formData) as $key) {
35
            $this->assertArrayHasKey($key, $children);
36
        }
37
    }
38
}
39