Complex classes like ComparatorTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ComparatorTest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 21 | class ComparatorTest extends TestCase |
||
| 22 | { |
||
| 23 | public function testCompareSame1() : void |
||
| 24 | { |
||
| 25 | $schema1 = new Schema([ |
||
| 26 | 'bugdb' => new Table( |
||
| 27 | 'bugdb', |
||
| 28 | [ |
||
| 29 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 30 | ] |
||
| 31 | ), |
||
| 32 | ]); |
||
| 33 | $schema2 = new Schema([ |
||
| 34 | 'bugdb' => new Table( |
||
| 35 | 'bugdb', |
||
| 36 | [ |
||
| 37 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 38 | ] |
||
| 39 | ), |
||
| 40 | ]); |
||
| 41 | |||
| 42 | $expected = new SchemaDiff(); |
||
| 43 | $expected->fromSchema = $schema1; |
||
| 44 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 45 | } |
||
| 46 | |||
| 47 | public function testCompareSame2() : void |
||
| 48 | { |
||
| 49 | $schema1 = new Schema([ |
||
| 50 | 'bugdb' => new Table( |
||
| 51 | 'bugdb', |
||
| 52 | [ |
||
| 53 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 54 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 55 | ] |
||
| 56 | ), |
||
| 57 | ]); |
||
| 58 | $schema2 = new Schema([ |
||
| 59 | 'bugdb' => new Table( |
||
| 60 | 'bugdb', |
||
| 61 | [ |
||
| 62 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 63 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 64 | ] |
||
| 65 | ), |
||
| 66 | ]); |
||
| 67 | |||
| 68 | $expected = new SchemaDiff(); |
||
| 69 | $expected->fromSchema = $schema1; |
||
| 70 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 71 | } |
||
| 72 | |||
| 73 | public function testCompareMissingTable() : void |
||
| 74 | { |
||
| 75 | $schemaConfig = new SchemaConfig(); |
||
| 76 | $table = new Table('bugdb', ['integerfield1' => new Column('integerfield1', Type::getType('integer'))]); |
||
| 77 | $table->setSchemaConfig($schemaConfig); |
||
| 78 | |||
| 79 | $schema1 = new Schema([$table], [], $schemaConfig); |
||
| 80 | $schema2 = new Schema([], [], $schemaConfig); |
||
| 81 | |||
| 82 | $expected = new SchemaDiff([], [], ['bugdb' => $table], $schema1); |
||
| 83 | |||
| 84 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 85 | } |
||
| 86 | |||
| 87 | public function testCompareNewTable() : void |
||
| 88 | { |
||
| 89 | $schemaConfig = new SchemaConfig(); |
||
| 90 | $table = new Table('bugdb', ['integerfield1' => new Column('integerfield1', Type::getType('integer'))]); |
||
| 91 | $table->setSchemaConfig($schemaConfig); |
||
| 92 | |||
| 93 | $schema1 = new Schema([], [], $schemaConfig); |
||
| 94 | $schema2 = new Schema([$table], [], $schemaConfig); |
||
| 95 | |||
| 96 | $expected = new SchemaDiff(['bugdb' => $table], [], [], $schema1); |
||
| 97 | |||
| 98 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 99 | } |
||
| 100 | |||
| 101 | public function testCompareOnlyAutoincrementChanged() : void |
||
| 102 | { |
||
| 103 | $column1 = new Column('foo', Type::getType('integer'), ['autoincrement' => true]); |
||
| 104 | $column2 = new Column('foo', Type::getType('integer'), ['autoincrement' => false]); |
||
| 105 | |||
| 106 | $comparator = new Comparator(); |
||
| 107 | $changedProperties = $comparator->diffColumn($column1, $column2); |
||
| 108 | |||
| 109 | self::assertEquals(['autoincrement'], $changedProperties); |
||
| 110 | } |
||
| 111 | |||
| 112 | public function testCompareMissingField() : void |
||
| 113 | { |
||
| 114 | $missingColumn = new Column('integerfield1', Type::getType('integer')); |
||
| 115 | $schema1 = new Schema([ |
||
| 116 | 'bugdb' => new Table( |
||
| 117 | 'bugdb', |
||
| 118 | [ |
||
| 119 | 'integerfield1' => $missingColumn, |
||
| 120 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 121 | ] |
||
| 122 | ), |
||
| 123 | ]); |
||
| 124 | $schema2 = new Schema([ |
||
| 125 | 'bugdb' => new Table( |
||
| 126 | 'bugdb', |
||
| 127 | [ |
||
| 128 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 129 | ] |
||
| 130 | ), |
||
| 131 | ]); |
||
| 132 | |||
| 133 | $expected = new SchemaDiff( |
||
| 134 | [], |
||
| 135 | [ |
||
| 136 | 'bugdb' => new TableDiff( |
||
| 137 | 'bugdb', |
||
| 138 | [], |
||
| 139 | [], |
||
| 140 | ['integerfield1' => $missingColumn] |
||
| 141 | ), |
||
| 142 | ] |
||
| 143 | ); |
||
| 144 | $expected->fromSchema = $schema1; |
||
| 145 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
||
| 146 | |||
| 147 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 148 | } |
||
| 149 | |||
| 150 | public function testCompareNewField() : void |
||
| 151 | { |
||
| 152 | $schema1 = new Schema([ |
||
| 153 | 'bugdb' => new Table( |
||
| 154 | 'bugdb', |
||
| 155 | [ |
||
| 156 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 157 | ] |
||
| 158 | ), |
||
| 159 | ]); |
||
| 160 | $schema2 = new Schema([ |
||
| 161 | 'bugdb' => new Table( |
||
| 162 | 'bugdb', |
||
| 163 | [ |
||
| 164 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 165 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 166 | ] |
||
| 167 | ), |
||
| 168 | ]); |
||
| 169 | |||
| 170 | $expected = new SchemaDiff( |
||
| 171 | [], |
||
| 172 | [ |
||
| 173 | 'bugdb' => new TableDiff( |
||
| 174 | 'bugdb', |
||
| 175 | [ |
||
| 176 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 177 | ] |
||
| 178 | ), |
||
| 179 | ] |
||
| 180 | ); |
||
| 181 | $expected->fromSchema = $schema1; |
||
| 182 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
||
| 183 | |||
| 184 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 185 | } |
||
| 186 | |||
| 187 | public function testCompareChangedColumnsChangeType() : void |
||
| 188 | { |
||
| 189 | $column1 = new Column('charfield1', Type::getType('string')); |
||
| 190 | $column2 = new Column('charfield1', Type::getType('integer')); |
||
| 191 | |||
| 192 | $c = new Comparator(); |
||
| 193 | self::assertEquals(['type'], $c->diffColumn($column1, $column2)); |
||
| 194 | self::assertEquals([], $c->diffColumn($column1, $column1)); |
||
| 195 | } |
||
| 196 | |||
| 197 | public function testCompareColumnsMultipleTypeInstances() : void |
||
| 198 | { |
||
| 199 | $integerType1 = Type::getType('integer'); |
||
| 200 | Type::overrideType('integer', get_class($integerType1)); |
||
| 201 | $integerType2 = Type::getType('integer'); |
||
| 202 | |||
| 203 | $column1 = new Column('integerfield1', $integerType1); |
||
| 204 | $column2 = new Column('integerfield1', $integerType2); |
||
| 205 | |||
| 206 | $c = new Comparator(); |
||
| 207 | self::assertEquals([], $c->diffColumn($column1, $column2)); |
||
| 208 | } |
||
| 209 | |||
| 210 | public function testCompareColumnsOverriddenType() : void |
||
| 211 | { |
||
| 212 | $oldStringInstance = Type::getType('string'); |
||
| 213 | $integerType = Type::getType('integer'); |
||
| 214 | |||
| 215 | Type::overrideType('string', get_class($integerType)); |
||
| 216 | $overriddenStringType = Type::getType('string'); |
||
| 217 | |||
| 218 | Type::overrideType('string', get_class($oldStringInstance)); |
||
| 219 | |||
| 220 | $column1 = new Column('integerfield1', $integerType); |
||
| 221 | $column2 = new Column('integerfield1', $overriddenStringType); |
||
| 222 | |||
| 223 | $c = new Comparator(); |
||
| 224 | self::assertEquals([], $c->diffColumn($column1, $column2)); |
||
| 225 | } |
||
| 226 | |||
| 227 | public function testCompareChangedColumnsChangeCustomSchemaOption() : void |
||
| 228 | { |
||
| 229 | $column1 = new Column('charfield1', Type::getType('string')); |
||
| 230 | $column2 = new Column('charfield1', Type::getType('string')); |
||
| 231 | |||
| 232 | $column1->setCustomSchemaOption('foo', 'bar'); |
||
| 233 | $column2->setCustomSchemaOption('foo', 'bar'); |
||
| 234 | |||
| 235 | $column1->setCustomSchemaOption('foo1', 'bar1'); |
||
| 236 | $column2->setCustomSchemaOption('foo2', 'bar2'); |
||
| 237 | |||
| 238 | $c = new Comparator(); |
||
| 239 | self::assertEquals(['foo1', 'foo2'], $c->diffColumn($column1, $column2)); |
||
| 240 | self::assertEquals([], $c->diffColumn($column1, $column1)); |
||
| 241 | } |
||
| 242 | |||
| 243 | public function testCompareChangeColumnsMultipleNewColumnsRename() : void |
||
| 244 | { |
||
| 245 | $tableA = new Table('foo'); |
||
| 246 | $tableA->addColumn('datefield1', 'datetime'); |
||
| 247 | |||
| 248 | $tableB = new Table('foo'); |
||
| 249 | $tableB->addColumn('new_datefield1', 'datetime'); |
||
| 250 | $tableB->addColumn('new_datefield2', 'datetime'); |
||
| 251 | |||
| 252 | $c = new Comparator(); |
||
| 253 | $tableDiff = $c->diffTable($tableA, $tableB); |
||
| 254 | |||
| 255 | self::assertCount(1, $tableDiff->renamedColumns, 'we should have one rename datefield1 => new_datefield1.'); |
||
| 256 | self::assertArrayHasKey('datefield1', $tableDiff->renamedColumns, "'datefield1' should be set to be renamed to new_datefield1"); |
||
| 257 | self::assertCount(1, $tableDiff->addedColumns, "'new_datefield2' should be added"); |
||
| 258 | self::assertArrayHasKey('new_datefield2', $tableDiff->addedColumns, "'new_datefield2' should be added, not created through renaming!"); |
||
| 259 | self::assertCount(0, $tableDiff->removedColumns, 'Nothing should be removed.'); |
||
| 260 | self::assertCount(0, $tableDiff->changedColumns, 'Nothing should be changed as all fields old & new have diff names.'); |
||
| 261 | } |
||
| 262 | |||
| 263 | public function testCompareRemovedIndex() : void |
||
| 264 | { |
||
| 265 | $schema1 = new Schema([ |
||
| 266 | 'bugdb' => new Table( |
||
| 267 | 'bugdb', |
||
| 268 | [ |
||
| 269 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 270 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 271 | ], |
||
| 272 | [ |
||
| 273 | 'primary' => new Index( |
||
| 274 | 'primary', |
||
| 275 | ['integerfield1'], |
||
| 276 | true |
||
| 277 | ), |
||
| 278 | ] |
||
| 279 | ), |
||
| 280 | ]); |
||
| 281 | $schema2 = new Schema([ |
||
| 282 | 'bugdb' => new Table( |
||
| 283 | 'bugdb', |
||
| 284 | [ |
||
| 285 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 286 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 287 | ] |
||
| 288 | ), |
||
| 289 | ]); |
||
| 290 | |||
| 291 | $expected = new SchemaDiff( |
||
| 292 | [], |
||
| 293 | [ |
||
| 294 | 'bugdb' => new TableDiff( |
||
| 295 | 'bugdb', |
||
| 296 | [], |
||
| 297 | [], |
||
| 298 | [], |
||
| 299 | [], |
||
| 300 | [], |
||
| 301 | [ |
||
| 302 | 'primary' => new Index( |
||
| 303 | 'primary', |
||
| 304 | ['integerfield1'], |
||
| 305 | true |
||
| 306 | ), |
||
| 307 | ] |
||
| 308 | ), |
||
| 309 | ] |
||
| 310 | ); |
||
| 311 | $expected->fromSchema = $schema1; |
||
| 312 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
||
| 313 | |||
| 314 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 315 | } |
||
| 316 | |||
| 317 | public function testCompareNewIndex() : void |
||
| 318 | { |
||
| 319 | $schema1 = new Schema([ |
||
| 320 | 'bugdb' => new Table( |
||
| 321 | 'bugdb', |
||
| 322 | [ |
||
| 323 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 324 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 325 | ] |
||
| 326 | ), |
||
| 327 | ]); |
||
| 328 | $schema2 = new Schema([ |
||
| 329 | 'bugdb' => new Table( |
||
| 330 | 'bugdb', |
||
| 331 | [ |
||
| 332 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 333 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 334 | ], |
||
| 335 | [ |
||
| 336 | 'primary' => new Index( |
||
| 337 | 'primary', |
||
| 338 | ['integerfield1'], |
||
| 339 | true |
||
| 340 | ), |
||
| 341 | ] |
||
| 342 | ), |
||
| 343 | ]); |
||
| 344 | |||
| 345 | $expected = new SchemaDiff( |
||
| 346 | [], |
||
| 347 | [ |
||
| 348 | 'bugdb' => new TableDiff( |
||
| 349 | 'bugdb', |
||
| 350 | [], |
||
| 351 | [], |
||
| 352 | [], |
||
| 353 | [ |
||
| 354 | 'primary' => new Index( |
||
| 355 | 'primary', |
||
| 356 | ['integerfield1'], |
||
| 357 | true |
||
| 358 | ), |
||
| 359 | ] |
||
| 360 | ), |
||
| 361 | ] |
||
| 362 | ); |
||
| 363 | $expected->fromSchema = $schema1; |
||
| 364 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
||
| 365 | |||
| 366 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 367 | } |
||
| 368 | |||
| 369 | public function testCompareChangedIndex() : void |
||
| 370 | { |
||
| 371 | $schema1 = new Schema([ |
||
| 372 | 'bugdb' => new Table( |
||
| 373 | 'bugdb', |
||
| 374 | [ |
||
| 375 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 376 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 377 | ], |
||
| 378 | [ |
||
| 379 | 'primary' => new Index( |
||
| 380 | 'primary', |
||
| 381 | ['integerfield1'], |
||
| 382 | true |
||
| 383 | ), |
||
| 384 | ] |
||
| 385 | ), |
||
| 386 | ]); |
||
| 387 | $schema2 = new Schema([ |
||
| 388 | 'bugdb' => new Table( |
||
| 389 | 'bugdb', |
||
| 390 | [ |
||
| 391 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 392 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 393 | ], |
||
| 394 | [ |
||
| 395 | 'primary' => new Index( |
||
| 396 | 'primary', |
||
| 397 | ['integerfield1', 'integerfield2'], |
||
| 398 | true |
||
| 399 | ), |
||
| 400 | ] |
||
| 401 | ), |
||
| 402 | ]); |
||
| 403 | |||
| 404 | $expected = new SchemaDiff( |
||
| 405 | [], |
||
| 406 | [ |
||
| 407 | 'bugdb' => new TableDiff( |
||
| 408 | 'bugdb', |
||
| 409 | [], |
||
| 410 | [], |
||
| 411 | [], |
||
| 412 | [], |
||
| 413 | [ |
||
| 414 | 'primary' => new Index( |
||
| 415 | 'primary', |
||
| 416 | [ |
||
| 417 | 'integerfield1', |
||
| 418 | 'integerfield2', |
||
| 419 | ], |
||
| 420 | true |
||
| 421 | ), |
||
| 422 | ] |
||
| 423 | ), |
||
| 424 | ] |
||
| 425 | ); |
||
| 426 | $expected->fromSchema = $schema1; |
||
| 427 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
||
| 428 | |||
| 429 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 430 | } |
||
| 431 | |||
| 432 | public function testCompareChangedIndexFieldPositions() : void |
||
| 433 | { |
||
| 434 | $schema1 = new Schema([ |
||
| 435 | 'bugdb' => new Table( |
||
| 436 | 'bugdb', |
||
| 437 | [ |
||
| 438 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 439 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 440 | ], |
||
| 441 | [ |
||
| 442 | 'primary' => new Index('primary', ['integerfield1', 'integerfield2'], true), |
||
| 443 | ] |
||
| 444 | ), |
||
| 445 | ]); |
||
| 446 | $schema2 = new Schema([ |
||
| 447 | 'bugdb' => new Table( |
||
| 448 | 'bugdb', |
||
| 449 | [ |
||
| 450 | 'integerfield1' => new Column('integerfield1', Type::getType('integer')), |
||
| 451 | 'integerfield2' => new Column('integerfield2', Type::getType('integer')), |
||
| 452 | ], |
||
| 453 | [ |
||
| 454 | 'primary' => new Index('primary', ['integerfield2', 'integerfield1'], true), |
||
| 455 | ] |
||
| 456 | ), |
||
| 457 | ]); |
||
| 458 | |||
| 459 | $expected = new SchemaDiff( |
||
| 460 | [], |
||
| 461 | [ |
||
| 462 | 'bugdb' => new TableDiff( |
||
| 463 | 'bugdb', |
||
| 464 | [], |
||
| 465 | [], |
||
| 466 | [], |
||
| 467 | [], |
||
| 468 | [ |
||
| 469 | 'primary' => new Index('primary', ['integerfield2', 'integerfield1'], true), |
||
| 470 | ] |
||
| 471 | ), |
||
| 472 | ] |
||
| 473 | ); |
||
| 474 | $expected->fromSchema = $schema1; |
||
| 475 | $expected->changedTables['bugdb']->fromTable = $schema1->getTable('bugdb'); |
||
| 476 | |||
| 477 | self::assertEquals($expected, Comparator::compareSchemas($schema1, $schema2)); |
||
| 478 | } |
||
| 479 | |||
| 480 | public function testCompareSequences() : void |
||
| 481 | { |
||
| 482 | $seq1 = new Sequence('foo', 1, 1); |
||
| 483 | $seq2 = new Sequence('foo', 1, 2); |
||
| 484 | $seq3 = new Sequence('foo', 2, 1); |
||
| 485 | $seq4 = new Sequence('foo', '1', '1'); |
||
| 486 | |||
| 487 | $c = new Comparator(); |
||
| 488 | |||
| 489 | self::assertTrue($c->diffSequence($seq1, $seq2)); |
||
| 490 | self::assertTrue($c->diffSequence($seq1, $seq3)); |
||
| 491 | self::assertFalse($c->diffSequence($seq1, $seq4)); |
||
| 492 | } |
||
| 493 | |||
| 494 | public function testRemovedSequence() : void |
||
| 507 | |||
| 508 | public function testAddedSequence() : void |
||
| 521 | |||
| 522 | public function testTableAddForeignKey() : void |
||
| 540 | |||
| 541 | public function testTableRemoveForeignKey() : void |
||
| 559 | |||
| 560 | public function testTableUpdateForeignKey() : void |
||
| 579 | |||
| 580 | public function testMovedForeignKeyForeignTable() : void |
||
| 602 | |||
| 603 | public function testTablesCaseInsensitive() : void |
||
| 622 | |||
| 623 | public function testSequencesCaseInsensitive() : void |
||
| 642 | |||
| 643 | public function testCompareColumnCompareCaseInsensitive() : void |
||
| 656 | |||
| 657 | public function testCompareIndexBasedOnPropertiesNotName() : void |
||
| 677 | |||
| 678 | public function testCompareForeignKeyBasedOnPropertiesNotName() : void |
||
| 693 | |||
| 694 | public function testCompareForeignKeyRestrictNoActionAreTheSame() : void |
||
| 702 | |||
| 703 | /** |
||
| 704 | * @group DBAL-492 |
||
| 705 | */ |
||
| 706 | public function testCompareForeignKeyNamesUnqualifiedAsNoSchemaInformationIsAvailable() : void |
||
| 714 | |||
| 715 | public function testDetectRenameColumn() : void |
||
| 731 | |||
| 732 | /** |
||
| 733 | * You can easily have ambiguities in the column renaming. If these |
||
| 734 | * are detected no renaming should take place, instead adding and dropping |
||
| 735 | * should be used exclusively. |
||
| 736 | * |
||
| 737 | * @group DBAL-24 |
||
| 738 | */ |
||
| 739 | public function testDetectRenameColumnAmbiguous() : void |
||
| 758 | |||
| 759 | /** |
||
| 760 | * @group DBAL-1063 |
||
| 761 | */ |
||
| 762 | public function testDetectRenameIndex() : void |
||
| 781 | |||
| 782 | /** |
||
| 783 | * You can easily have ambiguities in the index renaming. If these |
||
| 784 | * are detected no renaming should take place, instead adding and dropping |
||
| 785 | * should be used exclusively. |
||
| 786 | * |
||
| 787 | * @group DBAL-1063 |
||
| 788 | */ |
||
| 789 | public function testDetectRenameIndexAmbiguous() : void |
||
| 811 | |||
| 812 | public function testDetectChangeIdentifierType() : void |
||
| 828 | |||
| 829 | /** |
||
| 830 | * @group DBAL-105 |
||
| 831 | */ |
||
| 832 | public function testDiff() : void |
||
| 855 | |||
| 856 | /** |
||
| 857 | * @group DBAL-112 |
||
| 858 | */ |
||
| 859 | public function testChangedSequence() : void |
||
| 872 | |||
| 873 | /** |
||
| 874 | * @group DBAL-106 |
||
| 875 | */ |
||
| 876 | public function testDiffDecimalWithNullPrecision() : void |
||
| 886 | |||
| 887 | /** |
||
| 888 | * @group DBAL-204 |
||
| 889 | */ |
||
| 890 | public function testFqnSchemaComparison() : void |
||
| 906 | |||
| 907 | /** |
||
| 908 | * @group DBAL-669 |
||
| 909 | */ |
||
| 910 | public function testNamespacesComparison() : void |
||
| 933 | |||
| 934 | /** |
||
| 935 | * @group DBAL-204 |
||
| 936 | */ |
||
| 937 | public function testFqnSchemaComparisonDifferentSchemaNameButSameTableNoDiff() : void |
||
| 953 | |||
| 954 | /** |
||
| 955 | * @group DBAL-204 |
||
| 956 | */ |
||
| 957 | public function testFqnSchemaComparisonNoSchemaSame() : void |
||
| 972 | |||
| 973 | /** |
||
| 974 | * @group DDC-1657 |
||
| 975 | */ |
||
| 976 | public function testAutoIncrementSequences() : void |
||
| 994 | |||
| 995 | /** |
||
| 996 | * Check that added autoincrement sequence is not populated in newSequences |
||
| 997 | * |
||
| 998 | * @group DBAL-562 |
||
| 999 | */ |
||
| 1000 | public function testAutoIncrementNoSequences() : void |
||
| 1018 | |||
| 1019 | /** |
||
| 1020 | * You can get multiple drops for a FK when a table referenced by a foreign |
||
| 1021 | * key is deleted, as this FK is referenced twice, once on the orphanedForeignKeys |
||
| 1022 | * array because of the dropped table, and once on changedTables array. We |
||
| 1023 | * now check that the key is present once. |
||
| 1024 | */ |
||
| 1025 | public function testAvoidMultipleDropForeignKey() : void |
||
| 1057 | |||
| 1058 | public function testCompareChangedColumn() : void |
||
| 1079 | |||
| 1080 | public function testCompareChangedBinaryColumn() : void |
||
| 1101 | |||
| 1102 | /** |
||
| 1103 | * @group DBAL-617 |
||
| 1104 | */ |
||
| 1105 | public function testCompareQuotedAndUnquotedForeignKeyColumns() : void |
||
| 1115 | |||
| 1116 | public function assertSchemaTableChangeCount(SchemaDiff $diff, int $newTableCount = 0, int $changeTableCount = 0, int $removeTableCount = 0) : void |
||
| 1122 | |||
| 1123 | public function assertSchemaSequenceChangeCount( |
||
| 1133 | |||
| 1134 | public function testDiffColumnPlatformOptions() : void |
||
| 1150 | |||
| 1151 | public function testComplexDiffColumn() : void |
||
| 1167 | |||
| 1168 | /** |
||
| 1169 | * @group DBAL-669 |
||
| 1170 | */ |
||
| 1171 | public function testComparesNamespaces() : void |
||
| 1216 | |||
| 1217 | public function testCompareGuidColumns() : void |
||
| 1231 | |||
| 1232 | /** |
||
| 1233 | * @group DBAL-1009 |
||
| 1234 | * @dataProvider getCompareColumnComments |
||
| 1235 | */ |
||
| 1236 | public function testCompareColumnComments(?string $comment1, ?string $comment2, bool $equals) : void |
||
| 1253 | |||
| 1254 | /** |
||
| 1255 | * @return mixed[][] |
||
| 1256 | */ |
||
| 1257 | public static function getCompareColumnComments() : iterable |
||
| 1281 | |||
| 1282 | public function testForeignKeyRemovalWithRenamedLocalColumn() : void |
||
| 1283 | { |
||
| 1284 | $fromSchema = new Schema([ |
||
| 1285 | 'table1' => new Table( |
||
| 1286 | 'table1', |
||
| 1287 | [ |
||
| 1288 | 'id' => new Column('id', Type::getType('integer')), |
||
| 1289 | ] |
||
| 1290 | ), |
||
| 1291 | 'table2' => new Table( |
||
| 1292 | 'table2', |
||
| 1293 | [ |
||
| 1294 | 'id' => new Column('id', Type::getType('integer')), |
||
| 1295 | 'id_table1' => new Column('id_table1', Type::getType('integer')), |
||
| 1296 | ], |
||
| 1297 | [], |
||
| 1298 | [ |
||
| 1329 | } |
||
| 1330 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: