diff --git a/src/importer/class-tainacan-old-tainacan.php b/src/importer/class-tainacan-old-tainacan.php index 82b7f0a8a..3d5a0d412 100644 --- a/src/importer/class-tainacan-old-tainacan.php +++ b/src/importer/class-tainacan-old-tainacan.php @@ -92,6 +92,10 @@ class Old_Tainacan extends Importer $Tainacan_Taxonomies->insert($taxonomy); $inserted_taxonomy = $Tainacan_Taxonomies->fetch($taxonomy->get_id()); + + /*Insert old tainacan id*/ + add_post_meta($inserted_taxonomy->get_id(), 'old_tainacan_category_id', $category->term_id); + if(isset($category->children) && $inserted_taxonomy) { $this->add_all_terms($inserted_taxonomy, $category->children); @@ -122,6 +126,9 @@ class Old_Tainacan extends Importer $inserted_term = $Tainacan_Terms->insert($new_term); + /*Insert old tainacan id*/ + add_term_meta($inserted_term->get_id(), 'old_tainacan_category_id', $term->term_id ); + if(isset($term->children)) { $this->add_all_terms($taxonomy_father, $term->children, $inserted_term); diff --git a/tests/test-importer.php b/tests/test-importer.php index c3fbc7156..ee375db79 100644 --- a/tests/test-importer.php +++ b/tests/test-importer.php @@ -49,6 +49,7 @@ class ImporterTests extends TAINACAN_UnitTestCase { $_SESSION['tainacan_importer'][$id]->set_url($url); $_SESSION['tainacan_importer'][$id]->run(); + $this->assertTrue(true); }*/ /*public function test_file_old_tainacan () { @@ -242,7 +243,7 @@ class ImporterTests extends TAINACAN_UnitTestCase { public function test_fetch_file(){ $csv_importer = new Importer\CSV(); $id = $csv_importer->get_id(); - /*$_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' ); - $this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) );*/ + $_SESSION['tainacan_importer'][$id]->fetch_from_remote( 'http://localhost/wordpress-test/wp-json' ); + $this->assertTrue( isset( $_SESSION['tainacan_importer'][$id]->tmp_file ) ); } } \ No newline at end of file