Code Duplication    Length = 23-26 lines in 2 locations

src/Kunstmaan/FormBundle/Tests/unit/Entity/PageParts/MultiLineTextPagePartTest.php 1 location

@@ 53-75 (lines=23) @@
50
        $this->assertInternalType('string', $stringValue);
51
    }
52
53
    public function testAdaptForm()
54
    {
55
        $object = $this->object;
56
        $object->setRequired(true);
57
        $object->setRegex('.*example.*');
58
59
        $formBuilder = $this->getMockBuilder('Symfony\Component\Form\FormBuilder')
60
            ->disableOriginalConstructor()
61
            ->getMock();
62
63
        $formBuilder->expects($this->any())
64
            ->method('getData')
65
            ->willReturn([]);
66
67
        $fields = new ArrayObject();
68
        $object->setErrorMessageRequired('required');
69
        $object->setErrorMessageRegex('regex');
70
        $this->assertEquals(count($fields), 0);
71
        /* @var FormBuilderInterface $formBuilder */
72
        $object->adaptForm($formBuilder, $fields, 0);
73
        $this->assertTrue(count($fields) > 0);
74
        $this->assertEquals('required', $object->getErrorMessageRequired());
75
    }
76
77
    public function testGetDefaultAdminType()
78
    {

src/Kunstmaan/FormBundle/Tests/unit/Entity/PageParts/SingleLineTextPagePartTest.php 1 location

@@ 53-78 (lines=26) @@
50
        $this->assertInternalType('string', $stringValue);
51
    }
52
53
    public function testAdaptForm()
54
    {
55
        $object = $this->object;
56
        $object->setRequired(true);
57
        $object->setRegex('.*example.*');
58
59
        $formBuilder = $this->getMockBuilder('Symfony\Component\Form\FormBuilder')
60
            ->disableOriginalConstructor()
61
            ->getMock();
62
63
        $formBuilder->expects($this->any())
64
            ->method('getData')
65
            ->willReturn([]);
66
67
        $fields = new ArrayObject();
68
69
        $object->setErrorMessageRequired('required');
70
        $object->setErrorMessageRegex('regex');
71
        $this->assertEquals(count($fields), 0);
72
        /* @var FormBuilderInterface $formBuilder */
73
        $object->adaptForm($formBuilder, $fields, 0);
74
        $this->assertTrue(count($fields) > 0);
75
        $this->assertTrue($object->getRequired());
76
77
        $this->assertEquals('required', $object->getErrorMessageRequired());
78
    }
79
80
    public function testGetDefaultAdminType()
81
    {