AbstractDummyThirdChild example

public function testMappedObjectType()
    {
        $mapping = new ClassDiscriminatorMapping('type', [
            'first' => AbstractDummyFirstChild::class,
            'third' => AbstractDummyThirdChild::class,
        ]);

        $this->assertEquals('first', $mapping->getMappedObjectType(AbstractDummyFirstChild::class));
        $this->assertEquals('first', $mapping->getMappedObjectType(new AbstractDummyFirstChild()));
        $this->assertNull($mapping->getMappedObjectType(new AbstractDummySecondChild()));
        $this->assertSame('third', $mapping->getMappedObjectType(new AbstractDummyThirdChild()));
    }
}
Home | Imprint | This part of the site doesn't use cookies.