|
16 | 16 | use Doctrine\DBAL\Types\Type; |
17 | 17 | use PHPUnit\Framework\TestCase; |
18 | 18 | use function array_keys; |
| 19 | +use function get_class; |
19 | 20 |
|
20 | 21 | class ComparatorTest extends TestCase |
21 | 22 | { |
@@ -193,6 +194,36 @@ public function testCompareChangedColumnsChangeType() : void |
193 | 194 | self::assertEquals([], $c->diffColumn($column1, $column1)); |
194 | 195 | } |
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 | + |
196 | 227 | public function testCompareChangedColumnsChangeCustomSchemaOption() : void |
197 | 228 | { |
198 | 229 | $column1 = new Column('charfield1', Type::getType('string')); |
|
0 commit comments