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

BooleanFormSubmissionTypeTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFormType() 0 22 2
1
<?php
2
3
namespace Kunstmaan\FormBundle\Tests\Form;
4
5
use Kunstmaan\FormBundle\Entity\FormSubmissionFieldTypes\BooleanFormSubmissionField;
6
use Kunstmaan\FormBundle\Form\BooleanFormSubmissionType;
7
use Symfony\Component\Form\Test\TypeTestCase;
8
9
/**
10
 * Class BooleanFormSubmissionTypeTest
11
 */
12
class BooleanFormSubmissionTypeTest extends TypeTestCase
13
{
14
    public function testFormType()
15
    {
16
        $formData = ['value' => true];
17
18
        $form = $this->factory->create(BooleanFormSubmissionType::class);
19
        $field = new BooleanFormSubmissionField();
20
        $field->setValue(true);
21
22
        $form->submit($formData);
23
24
        $this->assertTrue($form->isSynchronized());
25
        $this->assertTrue($form->isValid());
26
27
        $this->assertEquals($field, $form->getData());
28
29
        $view = $form->createView();
30
        $children = $view->children;
31
32
        foreach (array_keys($formData) as $key) {
33
            $this->assertArrayHasKey($key, $children);
34
        }
35
    }
36
}
37