CustomArrayObject example



namespace Symfony\Component\Validator\Tests\Constraints;

use Symfony\Component\Validator\Tests\Fixtures\CustomArrayObject;

class CollectionValidatorCustomArrayObjectTest extends CollectionValidatorTestCase
{
    public function prepareTestData(array $contents)
    {
        return new CustomArrayObject($contents);
    }
}
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormFactoryBuilder;
use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject;

class MergeCollectionListenerCustomArrayObjectTest extends MergeCollectionListenerTestCase
{
    protected function getData(array $data)
    {
        return new CustomArrayObject($data);
    }

    protected function getBuilder($name = 'name'): FormBuilderInterface
    {
        return new FormBuilder($name, 'Symfony\Component\Form\Tests\Fixtures\CustomArrayObject', new EventDispatcher()(new FormFactoryBuilder())->getFormFactory());
    }
}

            'Root',
            'property.path',
            null
        );
    }

    public function testMessageObjectMustBeStringable()
    {
        $this->expectException(\TypeError::class);
        new ConstraintViolation(
            new CustomArrayObject(),
            '',
            [],
            'Root',
            'property.path',
            null
        );
    }

    public function testRetrievedPropertyPathIsAStringEvenIfNotSet()
    {
        self::assertSame(
            
Home | Imprint | This part of the site doesn't use cookies.