diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7NoMultilingualTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7NoMultilingualTest.php index a9243d0..350c102 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7NoMultilingualTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7NoMultilingualTest.php @@ -70,7 +70,7 @@ protected function getEntityCounts() { 'migration' => 73, 'node' => 5, 'node_type' => 6, - 'rdf_mapping' => 7, + 'rdf_mapping' => 8, 'search_page' => 2, 'shortcut' => 6, 'shortcut_set' => 2, @@ -138,6 +138,7 @@ protected function getAvailablePaths() { 'options', 'path', 'phone', + 'rdf', 'search', 'shortcut', 'statistics', @@ -167,7 +168,6 @@ protected function getAvailablePaths() { */ protected function getMissingPaths() { return [ - 'rdf', // These modules are in the missing path list because they are installed // on the source site but they are not installed on the destination site. 'syslog', diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php index 5e815cd..c1686db 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7ReviewPageTest.php @@ -76,6 +76,7 @@ protected function getAvailablePaths() { 'path', 'phone', 'profile', + 'rdf', 'search', 'shortcut', 'statistics', @@ -137,7 +138,6 @@ protected function getAvailablePaths() { */ protected function getMissingPaths() { return [ - 'rdf', 'views', ]; } diff --git a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php index 9ed36ad..c5fbacc 100644 --- a/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php +++ b/core/modules/migrate_drupal_ui/tests/src/Functional/d7/MigrateUpgrade7Test.php @@ -78,7 +78,7 @@ protected function getEntityCounts() { 'migration' => 73, 'node' => 5, 'node_type' => 6, - 'rdf_mapping' => 7, + 'rdf_mapping' => 8, 'search_page' => 2, 'shortcut' => 6, 'shortcut_set' => 2, @@ -146,6 +146,7 @@ protected function getAvailablePaths() { 'options', 'path', 'phone', + 'rdf', 'search', 'shortcut', 'statistics', @@ -175,7 +176,6 @@ protected function getAvailablePaths() { */ protected function getMissingPaths() { return [ - 'rdf', // These modules are in the missing path list because they are installed // on the source site but they are not installed on the destination site. 'syslog', diff --git a/core/modules/rdf/migrations/d7_rdf_mapping.yml b/core/modules/rdf/migrations/d7_rdf_mapping.yml index 330aded..de60bd3 100644 --- a/core/modules/rdf/migrations/d7_rdf_mapping.yml +++ b/core/modules/rdf/migrations/d7_rdf_mapping.yml @@ -1,7 +1,8 @@ id: d7_rdf_mapping -label: Drupal 7 RDF Mapping +label: Drupal 7 RDF Mappings migration_tags: - Drupal 7 + - Configuration source: plugin: d7_rdf_mapping process: diff --git a/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php b/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php index 91f954d..2dca9e0 100644 --- a/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php +++ b/core/modules/rdf/src/Plugin/migrate/source/d7/RdfMapping.php @@ -19,10 +19,7 @@ class RdfMapping extends DrupalSqlBase { * {@inheritdoc} */ public function query() { - $query = $this->select('rdf_mapping', 'r') - ->fields('r', ['type', 'bundle', 'mapping']) - ->orderBy('type'); - return $query; + return $this->select('rdf_mapping', 'r')->fields('r'); } /** @@ -52,7 +49,7 @@ public function fields() { 'bundle' => $this->t('The name of the bundle a mapping applies to.'), 'mapping' => $this->t('The serialized mapping of the bundle type and fields to RDF terms.'), 'types' => $this->t('RDF types.'), - 'fieldMappings' => $this->t('RDF field mappigs.'), + 'fieldMappings' => $this->t('RDF field mappings.'), ]; } @@ -60,9 +57,14 @@ public function fields() { * {@inheritdoc} */ public function getIds() { - $ids['type']['type'] = 'string'; - $ids['bundle']['type'] = 'string'; - return $ids; + return [ + 'type' => [ + 'type' => 'string', + ], + 'bundle' => [ + 'type' => 'string', + ], + ]; } } diff --git a/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php b/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php index 88e3165..c61a7c4 100644 --- a/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php +++ b/core/modules/rdf/tests/src/Kernel/Migrate/d7/MigrateRdfMappingTest.php @@ -6,7 +6,7 @@ use Drupal\Tests\migrate_drupal\Kernel\d7\MigrateDrupal7TestBase; /** - * Tests RDF mappings migration. + * Tests RDF mappings migration from Drupal 7 to 8. * * @group rdf */ diff --git a/core/modules/rdf/tests/src/Kernel/Plugin/migrate/source/d7/MigrateRdfMappingTest.php b/core/modules/rdf/tests/src/Kernel/Plugin/migrate/source/d7/MigrateRdfMappingTest.php deleted file mode 100644 index f75e60c..0000000 --- a/core/modules/rdf/tests/src/Kernel/Plugin/migrate/source/d7/MigrateRdfMappingTest.php +++ /dev/null @@ -1,35 +0,0 @@ - 'comment', + 'bundle' => 'comment_node_article', + 'mapping' => 'a:8:{s:7:"rdftype";a:2:{i:0;s:9:"sioc:Post";i:1;s:13:"sioct:Comment";}s:5:"title";a:1:{s:10:"predicates";a:1:{i:0;s:8:"dc:title";}}s:7:"created";a:3:{s:10:"predicates";a:2:{i:0;s:7:"dc:date";i:1;s:10:"dc:created";}s:8:"datatype";s:12:"xsd:dateTime";s:8:"callback";s:12:"date_iso8601";}s:7:"changed";a:3:{s:10:"predicates";a:1:{i:0;s:11:"dc:modified";}s:8:"datatype";s:12:"xsd:dateTime";s:8:"callback";s:12:"date_iso8601";}s:12:"comment_body";a:1:{s:10:"predicates";a:1:{i:0;s:15:"content:encoded";}}s:3:"pid";a:2:{s:10:"predicates";a:1:{i:0;s:13:"sioc:reply_of";}s:4:"type";s:3:"rel";}s:3:"uid";a:2:{s:10:"predicates";a:1:{i:0;s:16:"sioc:has_creator";}s:4:"type";s:3:"rel";}s:4:"name";a:1:{s:10:"predicates";a:1:{i:0;s:9:"foaf:name";}}}', + ], + [ + 'type' => 'node', + 'bundle' => 'article', + 'mapping' => 'a:9:{s:7:"rdftype";a:2:{i:0;s:9:"sioc:Item";i:1;s:13:"foaf:Document";}s:5:"title";a:1:{s:10:"predicates";a:1:{i:0;s:8:"dc:title";}}s:7:"created";a:3:{s:10:"predicates";a:2:{i:0;s:7:"dc:date";i:1;s:10:"dc:created";}s:8:"datatype";s:12:"xsd:dateTime";s:8:"callback";s:12:"date_iso8601";}s:7:"changed";a:3:{s:10:"predicates";a:1:{i:0;s:11:"dc:modified";}s:8:"datatype";s:12:"xsd:dateTime";s:8:"callback";s:12:"date_iso8601";}s:4:"body";a:1:{s:10:"predicates";a:1:{i:0;s:15:"content:encoded";}}s:3:"uid";a:2:{s:10:"predicates";a:1:{i:0;s:16:"sioc:has_creator";}s:4:"type";s:3:"rel";}s:4:"name";a:1:{s:10:"predicates";a:1:{i:0;s:9:"foaf:name";}}s:13:"comment_count";a:2:{s:10:"predicates";a:1:{i:0;s:16:"sioc:num_replies";}s:8:"datatype";s:11:"xsd:integer";}s:13:"last_activity";a:3:{s:10:"predicates";a:1:{i:0;s:23:"sioc:last_activity_date";}s:8:"datatype";s:12:"xsd:dateTime";s:8:"callback";s:12:"date_iso8601";}}', + ], + [ + 'type' => 'taxonomy_term', + 'bundle' => 'tags', + 'mapping' => 'a:5:{s:7:"rdftype";a:1:{i:0;s:12:"skos:Concept";}s:4:"name";a:1:{s:10:"predicates";a:2:{i:0;s:10:"rdfs:label";i:1;s:14:"skos:prefLabel";}}s:11:"description";a:1:{s:10:"predicates";a:1:{i:0;s:15:"skos:definition";}}s:3:"vid";a:2:{s:10:"predicates";a:1:{i:0;s:13:"skos:inScheme";}s:4:"type";s:3:"rel";}s:6:"parent";a:2:{s:10:"predicates";a:1:{i:0;s:12:"skos:broader";}s:4:"type";s:3:"rel";}}', + ], + [ + 'type' => 'user', + 'bundle' => 'user', + 'mapping' => 'a:3:{s:7:"rdftype";a:1:{i:0;s:16:"sioc:UserAccount";}s:4:"name";a:1:{s:10:"predicates";a:1:{i:0;s:9:"foaf:name";}}s:8:"homepage";a:2:{s:10:"predicates";a:1:{i:0;s:9:"foaf:page";}s:4:"type";s:3:"rel";}}', + ], + ]; + + // The expected results. + $tests[0]['expected_data'] = [ + [ + 'type' => 'comment', + 'bundle' => 'comment_node_article', + 'types' => [ + 'sioc:Post', + 'sioct:Comment', + ], + 'fieldMappings' => [ + 'changed' => [ + 'predicates' => [ + 'dc:modified', + ], + 'datatype' => 'xsd:dateTime', + 'callback' => 'date_iso8601', + ], + 'comment_body' => [ + 'predicates' => [ + 'content:encoded', + ], + ], + 'created' => [ + 'predicates' => [ + 'dc:date', + 'dc:created', + ], + 'datatype' => 'xsd:dateTime', + 'callback' => 'date_iso8601', + ], + 'name' => [ + 'predicates' => [ + 'foaf:name', + ], + ], + 'pid' => [ + 'predicates' => [ + 'sioc:reply_of', + ], + 'type' => 'rel', + ], + 'title' => [ + 'predicates' => [ + 'dc:title', + ], + ], + 'uid' => [ + 'predicates' => [ + 'sioc:has_creator', + ], + 'type' => 'rel', + ], + ], + ], + [ + 'type' => 'node', + 'bundle' => 'article', + 'types' => [ + 'sioc:Item', + 'foaf:Document', + ], + 'fieldMappings' => [ + 'body' => [ + 'predicates' => [ + 'content:encoded', + ], + ], + 'changed' => [ + 'predicates' => [ + 'dc:modified', + ], + 'datatype' => 'xsd:dateTime', + 'callback' => 'date_iso8601', + ], + 'comment_count' => [ + 'predicates' => [ + 'sioc:num_replies', + ], + 'datatype' => 'xsd:integer', + ], + 'created' => [ + 'predicates' => [ + 'dc:date', + 'dc:created', + ], + 'datatype' => 'xsd:dateTime', + 'callback' => 'date_iso8601', + ], + 'last_activity' => [ + 'predicates' => [ + 'sioc:last_activity_date', + ], + 'datatype' => 'xsd:dateTime', + 'callback' => 'date_iso8601', + ], + 'name' => [ + 'predicates' => [ + 'foaf:name', + ], + ], + 'title' => [ + 'predicates' => [ + 'dc:title', + ], + ], + 'uid' => [ + 'predicates' => [ + 'sioc:has_creator', + ], + 'type' => 'rel', + ], + ], + ], + [ + 'type' => 'taxonomy_term', + 'bundle' => 'tags', + 'types' => [ + 'skos:Concept', + ], + 'fieldMappings' => [ + 'description' => [ + 'predicates' => [ + 'skos:definition', + ], + ], + 'name' => [ + 'predicates' => [ + 'rdfs:label', + 'skos:prefLabel', + ], + ], + 'parent' => [ + 'predicates' => [ + 'skos:broader', + ], + 'type' => 'rel', + ], + 'vid' => [ + 'predicates' => [ + 'skos:inScheme', + ], + 'type' => 'rel', + ], + ], + ], + [ + 'type' => 'user', + 'bundle' => 'user', + 'types' => [ + 'sioc:UserAccount', + ], + 'fieldMappings' => [ + 'homepage' => [ + 'predicates' => [ + 'foaf:page', + ], + 'type' => 'rel', + ], + 'name' => [ + 'predicates' => [ + 'foaf:name', + ], + ], + ], + ], + ]; + + return $tests; + } + +}