Doctrine\SkeletonMapper\Tests\Functional\BaseImplementationTest::testClassMetadata PHP Method

testClassMetadata() public method

public testClassMetadata ( )
    public function testClassMetadata()
    {
        $object = $this->createTestObject();
        $object->setId(1);
        $class = $this->classMetadataFactory->getMetadataFor($this->userClassName);
        $this->assertEquals($this->userClassName, $class->name);
        $this->assertTrue($class->hasField('id'));
        $this->assertTrue($class->hasField('username'));
        $this->assertTrue($class->hasField('password'));
        $this->assertFalse($class->hasAssociation('password'));
        $this->assertFalse($class->isSingleValuedAssociation('password'));
        $this->assertFalse($class->isCollectionValuedAssociation('password'));
        $this->assertTrue($class->isIdentifier('id'));
        $this->assertFalse($class->isIdentifier('username'));
        $this->assertEquals(array('_id'), $class->getIdentifier());
        $this->assertEquals(array('id'), $class->getIdentifierFieldNames());
        $this->assertEquals(array('id', 'username', 'password', 'profile', 'groups'), $class->getFieldNames());
        $this->assertInstanceOf('ReflectionClass', $class->getReflectionClass());
        $this->assertEquals(array('id' => array('name' => '_id', 'fieldName' => 'id'), 'username' => array('name' => 'username', 'fieldName' => 'username'), 'password' => array('name' => 'password', 'fieldName' => 'password'), 'profile' => array('name' => 'profileId', 'fieldName' => 'profile'), 'groups' => array('name' => 'groupIds', 'fieldName' => 'groups')), $class->getFieldMappings());
        $this->assertEquals(array(), $class->getAssociationNames());
        $this->assertNull($class->getTypeOfField('username'));
        $this->assertEquals(array('_id' => 1), $class->getIdentifierValues($object));
    }