diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/TermSourceWithVocabularyFilterTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/TermSourceWithVocabularyFilterTest.php deleted file mode 100644 index 67c46cb..0000000 --- a/core/modules/taxonomy/tests/src/Unit/Migrate/TermSourceWithVocabularyFilterTest.php +++ /dev/null @@ -1,25 +0,0 @@ -migrationConfiguration['source']['vocabulary'] = array(5); - parent::setUp(); - $this->expectedResults = array_values(array_filter($this->expectedResults, function($result) { - return $result['vid'] == 5; - })); - // We know there are two rows with vid == 5. - $this->expectedCount = 2; - } - -} diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/TermTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/TermTest.php deleted file mode 100644 index ad2706b..0000000 --- a/core/modules/taxonomy/tests/src/Unit/Migrate/TermTest.php +++ /dev/null @@ -1,12 +0,0 @@ - 'test', - 'highWaterProperty' => array('field' => 'test'), - 'source' => array( - 'plugin' => 'd6_taxonomy_term', - ), - ); - - protected $expectedResults = array( - array( - 'tid' => 1, - 'vid' => 5, - 'name' => 'name value 1', - 'description' => 'description value 1', - 'weight' => 0, - 'parent' => array(0), - ), - array( - 'tid' => 2, - 'vid' => 6, - 'name' => 'name value 2', - 'description' => 'description value 2', - 'weight' => 0, - 'parent' => array(0), - ), - array( - 'tid' => 3, - 'vid' => 6, - 'name' => 'name value 3', - 'description' => 'description value 3', - 'weight' => 0, - 'parent' => array(0), - ), - array( - 'tid' => 4, - 'vid' => 5, - 'name' => 'name value 4', - 'description' => 'description value 4', - 'weight' => 1, - 'parent' => array(1), - ), - array( - 'tid' => 5, - 'vid' => 6, - 'name' => 'name value 5', - 'description' => 'description value 5', - 'weight' => 1, - 'parent' => array(2), - ), - array( - 'tid' => 6, - 'vid' => 6, - 'name' => 'name value 6', - 'description' => 'description value 6', - 'weight' => 0, - 'parent' => array(3, 2), - ), - ); - - /** - * {@inheritdoc} - */ - protected function setUp() { - foreach ($this->expectedResults as $k => $row) { - foreach ($row['parent'] as $parent) { - $this->databaseContents['term_hierarchy'][] = array( - 'tid' => $row['tid'], - 'parent' => $parent, - ); - } - unset($row['parent']); - $this->databaseContents['term_data'][$k] = $row; - } - parent::setUp(); - } - -} diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermSourceWithVocabularyFilterTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermSourceWithVocabularyFilterTest.php new file mode 100644 index 0000000..c0dcd50 --- /dev/null +++ b/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermSourceWithVocabularyFilterTest.php @@ -0,0 +1,25 @@ +migrationConfiguration['source']['vocabulary'] = array(5); + parent::setUp(); + $this->expectedResults = array_values(array_filter($this->expectedResults, function($result) { + return $result['vid'] == 5; + })); + // We know there are two rows with vid == 5. + $this->expectedCount = 2; + } + +} diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php new file mode 100644 index 0000000..a9e987c --- /dev/null +++ b/core/modules/taxonomy/tests/src/Unit/Migrate/d6/TermTest.php @@ -0,0 +1,12 @@ + 'test', + 'highWaterProperty' => array('field' => 'test'), + 'source' => array( + 'plugin' => 'd6_taxonomy_term', + ), + ); + + protected $expectedResults = array( + array( + 'tid' => 1, + 'vid' => 5, + 'name' => 'name value 1', + 'description' => 'description value 1', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 2, + 'vid' => 6, + 'name' => 'name value 2', + 'description' => 'description value 2', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 3, + 'vid' => 6, + 'name' => 'name value 3', + 'description' => 'description value 3', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 4, + 'vid' => 5, + 'name' => 'name value 4', + 'description' => 'description value 4', + 'weight' => 1, + 'parent' => array(1), + ), + array( + 'tid' => 5, + 'vid' => 6, + 'name' => 'name value 5', + 'description' => 'description value 5', + 'weight' => 1, + 'parent' => array(2), + ), + array( + 'tid' => 6, + 'vid' => 6, + 'name' => 'name value 6', + 'description' => 'description value 6', + 'weight' => 0, + 'parent' => array(3, 2), + ), + ); + + /** + * {@inheritdoc} + */ + protected function setUp() { + foreach ($this->expectedResults as $k => $row) { + foreach ($row['parent'] as $parent) { + $this->databaseContents['term_hierarchy'][] = array( + 'tid' => $row['tid'], + 'parent' => $parent, + ); + } + unset($row['parent']); + $this->databaseContents['term_data'][$k] = $row; + } + parent::setUp(); + } + +} diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermSourceWithVocabularyFilterTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermSourceWithVocabularyFilterTest.php new file mode 100644 index 0000000..251746c --- /dev/null +++ b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermSourceWithVocabularyFilterTest.php @@ -0,0 +1,25 @@ +migrationConfiguration['source']['vocabulary'] = array(5); + parent::setUp(); + $this->expectedResults = array_values(array_filter($this->expectedResults, function($result) { + return $result['vid'] == 5; + })); + // We know there are two rows with vid == 5. + $this->expectedCount = 2; + } + +} diff --git a/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermTest.php b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermTest.php new file mode 100644 index 0000000..25f9335 --- /dev/null +++ b/core/modules/taxonomy/tests/src/Unit/Migrate/d7/TermTest.php @@ -0,0 +1,12 @@ + 'test', + 'highWaterProperty' => array('field' => 'test'), + 'source' => array( + 'plugin' => 'd7_taxonomy_term', + ), + ); + + protected $expectedResults = array( + array( + 'tid' => 1, + 'vid' => 5, + 'machine_name' => 'tags', + 'name' => 'name value 1', + 'description' => 'description value 1', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 2, + 'vid' => 6, + 'machine_name' => 'categories', + 'name' => 'name value 2', + 'description' => 'description value 2', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 3, + 'vid' => 6, + 'machine_name' => 'categories', + 'name' => 'name value 3', + 'description' => 'description value 3', + 'weight' => 0, + 'parent' => array(0), + ), + array( + 'tid' => 4, + 'vid' => 5, + 'machine_name' => 'tags', + 'name' => 'name value 4', + 'description' => 'description value 4', + 'weight' => 1, + 'parent' => array(1), + ), + array( + 'tid' => 5, + 'vid' => 6, + 'machine_name' => 'categories', + 'name' => 'name value 5', + 'description' => 'description value 5', + 'weight' => 1, + 'parent' => array(2), + ), + array( + 'tid' => 6, + 'vid' => 6, + 'machine_name' => 'categories', + 'name' => 'name value 6', + 'description' => 'description value 6', + 'weight' => 0, + 'parent' => array(3, 2), + ), + ); + + /** + * {@inheritdoc} + */ + protected function setUp() { + foreach ($this->expectedResults as $k => $row) { + foreach ($row['parent'] as $parent) { + $this->databaseContents['taxonomy_term_hierarchy'][] = [ + 'tid' => $row['tid'], + 'parent' => $parent, + ]; + } + unset($row['parent']); + $this->databaseContents['taxonomy_term_data'][$k] = $row; + $this->databaseContents['taxonomy_vocabulary'][$row['vid']] = [ + 'vid' => $row['vid'], + 'machine_name' => $row['machine_name'], + ]; + $this->databaseContents['field_config_instance'][$row['machine_name']] = [ + 'field_name' => 'field_term_field', + 'entity_type' => 'taxonomy_term', + 'bundle' => $row['machine_name'], + 'deleted' => 0, + ]; + $this->databaseContents['field_data_field_term_field'][$row['machine_name']] = [ + 'entity_type' => 'taxonomy_term', + 'bundle' => $row['machine_name'], + 'deleted' => 0, + 'entity_id' => 1, + 'delta' => 0, + ]; + } + + parent::setUp(); + } + +}