diff --git a/includes/ContentImport/Importers/ImportersBaseFactory.php b/includes/ContentImport/Importers/ImportersBaseFactory.php index 453578ba..e92f8ede 100644 --- a/includes/ContentImport/Importers/ImportersBaseFactory.php +++ b/includes/ContentImport/Importers/ImportersBaseFactory.php @@ -111,14 +111,11 @@ public function selected() { * @return array */ protected function importers_info(): array { - return array_combine( - array_keys( $this->importers_map ), - array_map( - function ( $importer_class ) { - return $importer_class::info(); - }, - $this->importers_map - ) + return array_map( + function ( $importer_class ) { + return $importer_class::info(); + }, + $this->importers_map ); } } diff --git a/includes/ContentImport/Importers/Terms/ShallowDuplicating.php b/includes/ContentImport/Importers/Terms/ShallowDuplicating.php index 4487c1ed..648e4574 100644 --- a/includes/ContentImport/Importers/Terms/ShallowDuplicating.php +++ b/includes/ContentImport/Importers/Terms/ShallowDuplicating.php @@ -59,17 +59,13 @@ public function import( array $data ) { return $data; } - $source_terms_ids = wp_list_pluck( $source_terms, 'term_id' ); - $msls_terms = array_combine( - $source_terms_ids, - array_map( array( Term::class, 'create' ), $source_terms_ids ) - ); + $msls_terms = array_map( array( Term::class, 'create' ), wp_list_pluck( $source_terms, 'term_id' ) ); switch_to_blog( $this->import_coordinates->dest_blog_id ); - foreach ( $source_terms as $term ) { + foreach ( $source_terms as $key => $term ) { // is there a translation for the term in this blog? - $msls_term = $msls_terms[ $term->term_id ]; + $msls_term = $msls_terms[ $key ]; $dest_term_id = $msls_term->{$dest_lang}; if ( null === $dest_term_id ) { diff --git a/tests/phpunit/Admin/TestAdmin.php b/tests/phpunit/Admin/TestAdmin.php index c5fe4693..ebd3fc2a 100644 --- a/tests/phpunit/Admin/TestAdmin.php +++ b/tests/phpunit/Admin/TestAdmin.php @@ -232,7 +232,7 @@ public function test_settings_field_renders( string $method, string $expected ): } - function test_rewrite_tizio(): void { + public function test_rewrite_tizio(): void { $obj = $this->AdminFactory(); $post_type = \Mockery::mock( \WP_Post_Type::class ); @@ -246,7 +246,7 @@ function test_rewrite_tizio(): void { $obj->rewrite_tizio( 'tizio' ); } - function test_rewrite_pinko(): void { + public function test_rewrite_pinko(): void { $obj = $this->AdminFactory(); $post_type = \Mockery::mock( \WP_Post_Type::class ); @@ -260,7 +260,7 @@ function test_rewrite_pinko(): void { $obj->rewrite_pinko( 'pinko' ); } - function test_rewrite_pallino(): void { + public function test_rewrite_pallino(): void { $obj = $this->AdminFactory(); $post_type = \Mockery::mock( \WP_Post_Type::class ); @@ -274,14 +274,14 @@ function test_rewrite_pallino(): void { $obj->rewrite_pallino( 'pallino' ); } - function test_content_priority(): void { + public function test_content_priority(): void { $obj = $this->AdminFactory(); $this->expectOutputRegex( '/^