-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
DDC2387Test.php
30 lines (24 loc) · 1.16 KB
/
DDC2387Test.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
namespace Doctrine\Tests\ORM\Functional\Ticket;
use Doctrine\Tests\ORM\Functional\DatabaseDriverTestCase;
use Doctrine\ORM\Mapping\ClassMetadataInfo;
class DDC2387Test extends DatabaseDriverTestCase
{
/**
* @group DDC-2387
*/
public function testCompositeAssociationKeyDetection()
{
$product = new \Doctrine\DBAL\Schema\Table('ddc2387_product');
$product->addColumn('id', 'integer');
$product->setPrimaryKey(array('id'));
$attributes = new \Doctrine\DBAL\Schema\Table('ddc2387_attributes');
$attributes->addColumn('product_id', 'integer');
$attributes->addColumn('attribute_name', 'string');
$attributes->setPrimaryKey(array('product_id', 'attribute_name'));
$attributes->addForeignKeyConstraint('ddc2387_product', array('product_id'), array('product_id'));
$metadata = $this->convertToClassMetadata(array($product, $attributes), array());
$this->assertEquals(ClassMetadataInfo::GENERATOR_TYPE_NONE, $metadata['Ddc2387Attributes']->generatorType);
$this->assertEquals(ClassMetadataInfo::GENERATOR_TYPE_AUTO, $metadata['Ddc2387Product']->generatorType);
}
}