public function testGetMetadataForSingleClass()
{
// Self-made metadata
$cm1 = new ClassMetadata('Doctrine\\ODM\\MongoDB\\Tests\\Mapping\\TestDocument1');
$cm1->setCollection('group');
// Add a mapped field
$cm1->mapField(array('fieldName' => 'name', 'type' => 'string'));
// Add a mapped field
$cm1->mapField(array('fieldName' => 'id', 'id' => true));
// and a mapped association
$cm1->mapOneEmbedded(array('fieldName' => 'other', 'targetDocument' => 'Other'));
$cm1->mapOneEmbedded(array('fieldName' => 'association', 'targetDocument' => 'Other'));
// SUT
$cmf = new ClassMetadataFactoryTestSubject();
$cmf->setMetadataFor('Doctrine\\ODM\\MongoDB\\Tests\\Mapping\\TestDocument1', $cm1);
// Prechecks
$this->assertEquals(array(), $cm1->parentClasses);
$this->assertEquals(ClassMetadata::INHERITANCE_TYPE_NONE, $cm1->inheritanceType);
$this->assertTrue($cm1->hasField('name'));
$this->assertEquals(4, count($cm1->fieldMappings));
// Go
$cm1 = $cmf->getMetadataFor('Doctrine\\ODM\\MongoDB\\Tests\\Mapping\\TestDocument1');
$this->assertEquals('group', $cm1->collection);
$this->assertEquals(array(), $cm1->parentClasses);
$this->assertTrue($cm1->hasField('name'));
}