@@ 1255-1271 (lines=17) @@ | ||
1252 | * @group 2782 |
|
1253 | * @group 6654 |
|
1254 | */ |
|
1255 | public function testComparatorShouldAddCommentToLegacyJsonArrayTypeThatDoesNotHaveIt() : void |
|
1256 | { |
|
1257 | if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { |
|
1258 | $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); |
|
1259 | } |
|
1260 | ||
1261 | $this->_conn->executeQuery('CREATE TABLE json_array_test (parameters JSON NOT NULL)'); |
|
1262 | ||
1263 | $table = new Table('json_array_test'); |
|
1264 | $table->addColumn('parameters', 'json_array'); |
|
1265 | ||
1266 | $comparator = new Comparator(); |
|
1267 | $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); |
|
1268 | ||
1269 | self::assertInstanceOf(TableDiff::class, $tableDiff); |
|
1270 | self::assertSame(['comment'], $tableDiff->changedColumns['parameters']->changedProperties); |
|
1271 | } |
|
1272 | ||
1273 | /** |
|
1274 | * @group 2782 |
|
@@ 1277-1293 (lines=17) @@ | ||
1274 | * @group 2782 |
|
1275 | * @group 6654 |
|
1276 | */ |
|
1277 | public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayType() : void |
|
1278 | { |
|
1279 | if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { |
|
1280 | $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); |
|
1281 | } |
|
1282 | ||
1283 | $this->_conn->executeQuery('CREATE TABLE json_array_test (parameters JSON DEFAULT NULL)'); |
|
1284 | ||
1285 | $table = new Table('json_array_test'); |
|
1286 | $table->addColumn('parameters', 'json_array'); |
|
1287 | ||
1288 | $comparator = new Comparator(); |
|
1289 | $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); |
|
1290 | ||
1291 | self::assertInstanceOf(TableDiff::class, $tableDiff); |
|
1292 | self::assertSame(['notnull', 'comment'], $tableDiff->changedColumns['parameters']->changedProperties); |
|
1293 | } |
|
1294 | ||
1295 | /** |
|
1296 | * @group 2782 |
|
@@ 1299-1315 (lines=17) @@ | ||
1296 | * @group 2782 |
|
1297 | * @group 6654 |
|
1298 | */ |
|
1299 | public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayTypeEvenWhenPlatformHasJsonSupport() : void |
|
1300 | { |
|
1301 | if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { |
|
1302 | $this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); |
|
1303 | } |
|
1304 | ||
1305 | $this->_conn->executeQuery('CREATE TABLE json_array_test (parameters JSON DEFAULT NULL)'); |
|
1306 | ||
1307 | $table = new Table('json_array_test'); |
|
1308 | $table->addColumn('parameters', 'json_array'); |
|
1309 | ||
1310 | $comparator = new Comparator(); |
|
1311 | $tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); |
|
1312 | ||
1313 | self::assertInstanceOf(TableDiff::class, $tableDiff); |
|
1314 | self::assertSame(['notnull', 'comment'], $tableDiff->changedColumns['parameters']->changedProperties); |
|
1315 | } |
|
1316 | ||
1317 | /** |
|
1318 | * @group 2782 |