| @@ 338-348 (lines=11) @@ | ||
| 335 | self::assertTrue($table->getIndex('my_idx')->spansColumns(['id'])); |
|
| 336 | } |
|
| 337 | ||
| 338 | public function testAddPrimaryKeyColumnsAreExplicitlySetToNotNull() : void |
|
| 339 | { |
|
| 340 | $table = new Table('foo'); |
|
| 341 | $column = $table->addColumn('id', 'integer', ['notnull' => false]); |
|
| 342 | ||
| 343 | self::assertFalse($column->getNotnull()); |
|
| 344 | ||
| 345 | $table->setPrimaryKey(['id']); |
|
| 346 | ||
| 347 | self::assertTrue($column->getNotnull()); |
|
| 348 | } |
|
| 349 | ||
| 350 | /** |
|
| 351 | * @group DDC-133 |
|
| @@ 592-602 (lines=11) @@ | ||
| 589 | /** |
|
| 590 | * @group DBAL-79 |
|
| 591 | */ |
|
| 592 | public function testTableHasPrimaryKey() : void |
|
| 593 | { |
|
| 594 | $table = new Table('test'); |
|
| 595 | ||
| 596 | self::assertFalse($table->hasPrimaryKey()); |
|
| 597 | ||
| 598 | $table->addColumn('foo', 'integer'); |
|
| 599 | $table->setPrimaryKey(['foo']); |
|
| 600 | ||
| 601 | self::assertTrue($table->hasPrimaryKey()); |
|
| 602 | } |
|
| 603 | ||
| 604 | /** |
|
| 605 | * @group DBAL-91 |
|
| @@ 672-682 (lines=11) @@ | ||
| 669 | /** |
|
| 670 | * @group DBAL-224 |
|
| 671 | */ |
|
| 672 | public function testDropPrimaryKey() : void |
|
| 673 | { |
|
| 674 | $table = new Table('test'); |
|
| 675 | $table->addColumn('id', 'integer'); |
|
| 676 | $table->setPrimaryKey(['id']); |
|
| 677 | ||
| 678 | self::assertTrue($table->hasPrimaryKey()); |
|
| 679 | ||
| 680 | $table->dropPrimaryKey(); |
|
| 681 | self::assertFalse($table->hasPrimaryKey()); |
|
| 682 | } |
|
| 683 | ||
| 684 | /** |
|
| 685 | * @group DBAL-234 |
|