|
@@ 421-438 (lines=18) @@
|
| 418 |
|
self::assertSame(array('bar', 'baz'), $table->getIndex('idx_8c73652176ff8caa78240498')->getColumns()); |
| 419 |
|
} |
| 420 |
|
|
| 421 |
|
public function testAddForeignKeyDoesNotAddImplicitIndexIfIndexColumnsSpan() |
| 422 |
|
{ |
| 423 |
|
$table = new Table('foo'); |
| 424 |
|
$table->addColumn('bar', 'integer'); |
| 425 |
|
$table->addColumn('baz', 'string'); |
| 426 |
|
$table->addColumn('bloo', 'string'); |
| 427 |
|
$table->addIndex(array('baz', 'bar'), 'composite_idx'); |
| 428 |
|
|
| 429 |
|
$foreignTable = new Table('bar'); |
| 430 |
|
$foreignTable->addColumn('foo', 'integer'); |
| 431 |
|
$foreignTable->addColumn('baz', 'string'); |
| 432 |
|
|
| 433 |
|
$table->addForeignKeyConstraint($foreignTable, array('baz', 'bar'), array('foo', 'baz')); |
| 434 |
|
|
| 435 |
|
self::assertCount(1, $table->getIndexes()); |
| 436 |
|
self::assertTrue($table->hasIndex('composite_idx')); |
| 437 |
|
self::assertSame(array('baz', 'bar'), $table->getIndex('composite_idx')->getColumns()); |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
public function testAddForeignKeyDoesNotAddImplicitIndexIfLongerIndexColumnsSpan() |
| 441 |
|
{ |
|
@@ 440-457 (lines=18) @@
|
| 437 |
|
self::assertSame(array('baz', 'bar'), $table->getIndex('composite_idx')->getColumns()); |
| 438 |
|
} |
| 439 |
|
|
| 440 |
|
public function testAddForeignKeyDoesNotAddImplicitIndexIfLongerIndexColumnsSpan() |
| 441 |
|
{ |
| 442 |
|
$table = new Table('foo'); |
| 443 |
|
$table->addColumn('bar', 'integer'); |
| 444 |
|
$table->addColumn('baz', 'string'); |
| 445 |
|
$table->addColumn('bloo', 'string'); |
| 446 |
|
$table->addIndex(array('baz', 'bar', 'bloo'), 'composite_idx'); |
| 447 |
|
|
| 448 |
|
$foreignTable = new Table('bar'); |
| 449 |
|
$foreignTable->addColumn('foo', 'integer'); |
| 450 |
|
$foreignTable->addColumn('baz', 'string'); |
| 451 |
|
|
| 452 |
|
$table->addForeignKeyConstraint($foreignTable, array('baz', 'bar'), array('foo', 'baz')); |
| 453 |
|
|
| 454 |
|
self::assertCount(1, $table->getIndexes()); |
| 455 |
|
self::assertTrue($table->hasIndex('composite_idx')); |
| 456 |
|
self::assertSame(array('baz', 'bar', 'bloo'), $table->getIndex('composite_idx')->getColumns()); |
| 457 |
|
} |
| 458 |
|
|
| 459 |
|
/** |
| 460 |
|
* @group DBAL-50 |