1
0
mirror of synced 2024-12-14 07:06:04 +03:00

Fixed #DDC-647

Added missing length element

DBAL-647 - Added test to check for length of string type in all mapping drivers
This commit is contained in:
Christian Heinrich 2010-06-22 20:24:05 +02:00 committed by Benjamin Eberlei
parent fc7224f73e
commit 321fc2506d
2 changed files with 28 additions and 2 deletions

View File

@ -147,6 +147,10 @@ class YamlDriver extends AbstractFileDriver
$mapping['columnName'] = $idElement['column'];
}
if (isset($idElement['length'])) {
$mapping['length'] = $idElement['length'];
}
$metadata->mapField($mapping);
if (isset($idElement['generator'])) {
@ -443,4 +447,4 @@ class YamlDriver extends AbstractFileDriver
{
return \Symfony\Components\Yaml\Yaml::load($file);
}
}
}

View File

@ -96,10 +96,32 @@ abstract class AbstractMappingDriverTest extends \Doctrine\Tests\OrmTestCase
$this->assertTrue(isset($class->fieldMappings['name']));
$this->assertTrue(isset($class->fieldMappings['email']));
return $class;
}
/**
* @depends testEntityTableNameAndInheritance
* @param ClassMetadata $class
*/
public function testFieldMappingsColumnNames($class)
{
$this->assertEquals("id", $class->fieldMappings['id']['columnName']);
$this->assertEquals("name", $class->fieldMappings['name']['columnName']);
$this->assertEquals("user_email", $class->fieldMappings['email']['columnName']);
return $class;
}
/**
* @depends testEntityTableNameAndInheritance
* @param ClassMetadata $class
*/
public function testStringFieldMappings($class)
{
$this->assertEquals('string', $class->fieldMappings['name']['type']);
$this->assertEquals(50, $class->fieldMappings['name']['length']);
$this->assertTrue($class->fieldMappings['name']['nullable']);
$this->assertTrue($class->fieldMappings['name']['unique']);
$this->assertEquals("user_email", $class->fieldMappings['email']['columnName']);
return $class;
}