Code Duplication    Length = 31-31 lines in 2 locations

src/Kunstmaan/FormBundle/Tests/unit/Form/CheckboxPagePartAdminTypeTest.php 1 location

@@ 12-42 (lines=31) @@
9
/**
10
 * Class CheckboxPagePartAdminTypeTest
11
 */
12
class CheckboxPagePartAdminTypeTest extends TypeTestCase
13
{
14
    public function testFormType()
15
    {
16
        $formData = [
17
            'required' => false,
18
            'label' => 'check this box!',
19
            'errormessage_required' => 'fill in the form',
20
        ];
21
22
        $form = $this->factory->create(CheckboxPagePartAdminType::class);
23
24
        $object = new CheckboxPagePart();
25
        $object->setRequired(false);
26
        $object->setErrorMessageRequired('fill in the form');
27
        $object->setLabel('check this box!');
28
29
        $form->submit($formData);
30
31
        $this->assertTrue($form->isSynchronized());
32
        $this->assertTrue($form->isValid());
33
        $this->assertEquals($object, $form->getData());
34
35
        $view = $form->createView();
36
        $children = $view->children;
37
38
        foreach (array_keys($formData) as $key) {
39
            $this->assertArrayHasKey($key, $children);
40
        }
41
    }
42
}
43

src/Kunstmaan/FormBundle/Tests/unit/Form/FileUploadPagePartAdminTypeTest.php 1 location

@@ 12-42 (lines=31) @@
9
/**
10
 * Class FileUploadPagePartAdminTypeTest
11
 */
12
class FileUploadPagePartAdminTypeTest extends TypeTestCase
13
{
14
    public function testFormType()
15
    {
16
        $formData = [
17
            'required' => false,
18
            'label' => 'xyz',
19
            'errormessage_required' => 'fill in the form',
20
        ];
21
22
        $form = $this->factory->create(FileUploadPagePartAdminType::class);
23
24
        $object = new FileUploadPagePart();
25
        $object->setRequired(false);
26
        $object->setErrorMessageRequired('fill in the form');
27
        $object->setLabel('xyz');
28
29
        $form->submit($formData);
30
31
        $this->assertTrue($form->isSynchronized());
32
        $this->assertTrue($form->isValid());
33
        $this->assertEquals($object, $form->getData());
34
35
        $view = $form->createView();
36
        $children = $view->children;
37
38
        foreach (array_keys($formData) as $key) {
39
            $this->assertArrayHasKey($key, $children);
40
        }
41
    }
42
}
43