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

StringFormSubmissionTypeTest::testFormType()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 24

Duplication

Lines 24
Ratio 100 %

Importance

Changes 0
Metric Value
dl 24
loc 24
rs 9.536
c 0
b 0
f 0
nc 2
cc 2
nop 0
1
<?php
2
3
namespace Kunstmaan\FormBundle\Tests\Form;
4
5
use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\StringFormSubmissionField;
6
use Kunstmaan\FormBundle\Form\StringFormSubmissionType;
7
use Symfony\Component\Form\Test\TypeTestCase;
8
9
/**
10
 * Class StringFormSubmissionTypeTest
11
 * @package Tests\Kunstmaan\FormBundle\Entity
12
 */
13 View Code Duplication
class StringFormSubmissionTypeTest 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...
14
{
15
    public function testFormType()
16
    {
17
        $formData = [
18
            'value' => 'ball of string',
19
        ];
20
21
        $form = $this->factory->create(StringFormSubmissionType::class);
22
23
        $object = new StringFormSubmissionField();
24
        $object->setValue('ball of string');
25
26
        $form->submit($formData);
27
28
        $this->assertTrue($form->isSynchronized());
29
        $this->assertTrue($form->isValid());
30
        $this->assertEquals($object, $form->getData());
31
32
        $view = $form->createView();
33
        $children = $view->children;
34
35
        foreach (array_keys($formData) as $key) {
36
            $this->assertArrayHasKey($key, $children);
37
        }
38
    }
39
}
40