|
@@ 218-229 (lines=12) @@
|
| 215 |
|
self::assertEquals('bar', $table->getOption('foo')); |
| 216 |
|
} |
| 217 |
|
|
| 218 |
|
public function testBuilderSetPrimaryKey() : void |
| 219 |
|
{ |
| 220 |
|
$table = new Table('foo'); |
| 221 |
|
|
| 222 |
|
$table->addColumn('bar', 'integer'); |
| 223 |
|
$table->setPrimaryKey(['bar']); |
| 224 |
|
|
| 225 |
|
self::assertTrue($table->hasIndex('primary')); |
| 226 |
|
self::assertInstanceOf(Index::class, $table->getPrimaryKey()); |
| 227 |
|
self::assertTrue($table->getIndex('primary')->isUnique()); |
| 228 |
|
self::assertTrue($table->getIndex('primary')->isPrimary()); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
public function testBuilderAddUniqueIndex() : void |
| 232 |
|
{ |
|
@@ 231-241 (lines=11) @@
|
| 228 |
|
self::assertTrue($table->getIndex('primary')->isPrimary()); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
public function testBuilderAddUniqueIndex() : void |
| 232 |
|
{ |
| 233 |
|
$table = new Table('foo'); |
| 234 |
|
|
| 235 |
|
$table->addColumn('bar', 'integer'); |
| 236 |
|
$table->addUniqueIndex(['bar'], 'my_idx'); |
| 237 |
|
|
| 238 |
|
self::assertTrue($table->hasIndex('my_idx')); |
| 239 |
|
self::assertTrue($table->getIndex('my_idx')->isUnique()); |
| 240 |
|
self::assertFalse($table->getIndex('my_idx')->isPrimary()); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
public function testBuilderAddIndex() : void |
| 244 |
|
{ |
|
@@ 243-253 (lines=11) @@
|
| 240 |
|
self::assertFalse($table->getIndex('my_idx')->isPrimary()); |
| 241 |
|
} |
| 242 |
|
|
| 243 |
|
public function testBuilderAddIndex() : void |
| 244 |
|
{ |
| 245 |
|
$table = new Table('foo'); |
| 246 |
|
|
| 247 |
|
$table->addColumn('bar', 'integer'); |
| 248 |
|
$table->addIndex(['bar'], 'my_idx'); |
| 249 |
|
|
| 250 |
|
self::assertTrue($table->hasIndex('my_idx')); |
| 251 |
|
self::assertFalse($table->getIndex('my_idx')->isUnique()); |
| 252 |
|
self::assertFalse($table->getIndex('my_idx')->isPrimary()); |
| 253 |
|
} |
| 254 |
|
|
| 255 |
|
public function testBuilderAddIndexWithInvalidNameThrowsException() : void |
| 256 |
|
{ |