| @@ 345-355 (lines=11) @@ | ||
| 342 | self::assertTrue($table->getIndex('my_idx')->spansColumns(['id'])); |
|
| 343 | } |
|
| 344 | ||
| 345 | public function testAddPrimaryKeyColumnsAreExplicitlySetToNotNull() : void |
|
| 346 | { |
|
| 347 | $table = new Table('foo'); |
|
| 348 | $column = $table->addColumn('id', 'integer', ['notnull' => false]); |
|
| 349 | ||
| 350 | self::assertFalse($column->getNotnull()); |
|
| 351 | ||
| 352 | $table->setPrimaryKey(['id']); |
|
| 353 | ||
| 354 | self::assertTrue($column->getNotnull()); |
|
| 355 | } |
|
| 356 | ||
| 357 | /** |
|
| 358 | * @group DDC-133 |
|
| @@ 599-609 (lines=11) @@ | ||
| 596 | /** |
|
| 597 | * @group DBAL-79 |
|
| 598 | */ |
|
| 599 | public function testTableHasPrimaryKey() : void |
|
| 600 | { |
|
| 601 | $table = new Table('test'); |
|
| 602 | ||
| 603 | self::assertFalse($table->hasPrimaryKey()); |
|
| 604 | ||
| 605 | $table->addColumn('foo', 'integer'); |
|
| 606 | $table->setPrimaryKey(['foo']); |
|
| 607 | ||
| 608 | self::assertTrue($table->hasPrimaryKey()); |
|
| 609 | } |
|
| 610 | ||
| 611 | /** |
|
| 612 | * @group DBAL-91 |
|
| @@ 679-689 (lines=11) @@ | ||
| 676 | /** |
|
| 677 | * @group DBAL-224 |
|
| 678 | */ |
|
| 679 | public function testDropPrimaryKey() : void |
|
| 680 | { |
|
| 681 | $table = new Table('test'); |
|
| 682 | $table->addColumn('id', 'integer'); |
|
| 683 | $table->setPrimaryKey(['id']); |
|
| 684 | ||
| 685 | self::assertTrue($table->hasPrimaryKey()); |
|
| 686 | ||
| 687 | $table->dropPrimaryKey(); |
|
| 688 | self::assertFalse($table->hasPrimaryKey()); |
|
| 689 | } |
|
| 690 | ||
| 691 | /** |
|
| 692 | * @group DBAL-234 |
|