Old Tainacan importer: Categories - adding old tainacan category ID

This commit is contained in:
andre2ar 2018-05-03 10:53:07 -03:00
parent 261f1203bf
commit e79f154a7d
2 changed files with 10 additions and 2 deletions

View File

@ -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);

View File

@ -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 ) );
}
}