Mercurial > hg > isophonics-drupal-site
comparison core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | c2387f117808 |
children |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
527 try { | 527 try { |
528 $id_map->lookupDestinationIds([1, 2, 3]); | 528 $id_map->lookupDestinationIds([1, 2, 3]); |
529 $this->fail('Too many source IDs should throw'); | 529 $this->fail('Too many source IDs should throw'); |
530 } | 530 } |
531 catch (MigrateException $e) { | 531 catch (MigrateException $e) { |
532 $this->assertEquals("Extra unknown items in source IDs: array (\n 0 => 3,\n)", $e->getMessage()); | 532 $this->assertEquals("Extra unknown items for map migrate_map_sql_idmap_test in source IDs: array (\n 0 => 3,\n)", $e->getMessage()); |
533 } | 533 } |
534 try { | 534 try { |
535 $id_map->lookupDestinationIds(['nid' => 1, 'aaa' => '2']); | 535 $id_map->lookupDestinationIds(['nid' => 1, 'aaa' => '2']); |
536 $this->fail('Unknown source ID key should throw'); | 536 $this->fail('Unknown source ID key should throw'); |
537 } | 537 } |
538 catch (MigrateException $e) { | 538 catch (MigrateException $e) { |
539 $this->assertEquals("Extra unknown items in source IDs: array (\n 'aaa' => '2',\n)", $e->getMessage()); | 539 $this->assertEquals("Extra unknown items for map migrate_map_sql_idmap_test in source IDs: array (\n 'aaa' => '2',\n)", $e->getMessage()); |
540 } | 540 } |
541 | 541 |
542 // Verify that we are looking up by source_id_hash when all source IDs are | 542 // Verify that we are looking up by source_id_hash when all source IDs are |
543 // passed in. | 543 // passed in. |
544 $id_map->getDatabase()->update($id_map->mapTableName()) | 544 $id_map->getDatabase()->update($id_map->mapTableName()) |
1010 $contents[] = (array) $row; | 1010 $contents[] = (array) $row; |
1011 } | 1011 } |
1012 return $contents; | 1012 return $contents; |
1013 } | 1013 } |
1014 | 1014 |
1015 /** | |
1016 * Tests the delayed creation of the "map" and "message" migrate tables. | |
1017 */ | |
1018 public function testMapTableCreation() { | |
1019 $id_map = $this->getIdMap(); | |
1020 $map_table_name = $id_map->mapTableName(); | |
1021 $message_table_name = $id_map->messageTableName(); | |
1022 | |
1023 // Check that tables names do exist. | |
1024 $this->assertEquals('migrate_map_sql_idmap_test', $map_table_name); | |
1025 $this->assertEquals('migrate_message_sql_idmap_test', $message_table_name); | |
1026 | |
1027 // Check that tables don't exist. | |
1028 $this->assertFalse($this->database->schema()->tableExists($map_table_name)); | |
1029 $this->assertFalse($this->database->schema()->tableExists($message_table_name)); | |
1030 | |
1031 $id_map->getDatabase(); | |
1032 | |
1033 // Check that tables do exist. | |
1034 $this->assertTrue($this->database->schema()->tableExists($map_table_name)); | |
1035 $this->assertTrue($this->database->schema()->tableExists($message_table_name)); | |
1036 } | |
1037 | |
1015 } | 1038 } |