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