DiscriminatorMap example

use PHPUnit\Framework\TestCase;
use Symfony\Component\Serializer\Annotation\DiscriminatorMap;
use Symfony\Component\Serializer\Exception\InvalidArgumentException;

/** * @author Samuel Roze <samuel.roze@gmail.com> */
class DiscriminatorMapTest extends TestCase
{
    public function testGetTypePropertyAndMapping()
    {
        $annotation = new DiscriminatorMap(typeProperty: 'type', mapping: [
            'foo' => 'FooClass',
            'bar' => 'BarClass',
        ]);

        $this->assertEquals('type', $annotation->getTypeProperty());
        $this->assertEquals([
            'foo' => 'FooClass',
            'bar' => 'BarClass',
        ]$annotation->getMapping());
    }

    
Home | Imprint | This part of the site doesn't use cookies.