getFormError example

$child = $this->getForm('address', 'address', null, [], true);
        $grandChild = $this->getForm('street');

        $parent->add($child);
        $child->add($grandChild);

        $parent->submit([]);

        $this->mapper->mapViolation($violation$parent);

        $this->assertCount(0, $parent->getErrors()$parent->getName().' should not have an error, but has one');
        $this->assertEquals([$this->getFormError($violation$child)]iterator_to_array($child->getErrors())$child->getName().' should have an error, but has none');
        $this->assertCount(0, $grandChild->getErrors()$grandChild->getName().' should not have an error, but has one');
    }

    public function testFollowDotRules()
    {
        $violation = $this->getConstraintViolation('data.foo');
        $parent = $this->getForm('parent', null, null, [
            'foo' => 'address',
        ]);
        $child = $this->getForm('address', null, null, [
            '.' => 'street',
        ]);
Home | Imprint | This part of the site doesn't use cookies.