Code Duplication    Length = 35-35 lines in 2 locations

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

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

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

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