From aac9d2b85b7feef0d35cb7f3db403b8011049661 Mon Sep 17 00:00:00 2001 From: weryques Date: Mon, 21 Jan 2019 10:32:22 -0200 Subject: [PATCH] Fixes function not found in entity taxonomy --- tests/factories/class-tainacan-entity-factory.php | 6 ++++-- tests/test-taxonomies.php | 6 ++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/factories/class-tainacan-entity-factory.php b/tests/factories/class-tainacan-entity-factory.php index 583df9877..2b2c7a366 100644 --- a/tests/factories/class-tainacan-entity-factory.php +++ b/tests/factories/class-tainacan-entity-factory.php @@ -37,6 +37,8 @@ class Entity_Factory { $Tainacan_Item_Metadata = \Tainacan\Repositories\Item_Metadata::get_instance(); try { + $type = trim($type); + if(empty($type)){ throw new \InvalidArgumentException('The type can\'t be empty'); } elseif(!strrchr($type, '_')){ @@ -68,7 +70,7 @@ class Entity_Factory { if (!empty($args) && $is_validated_and_in_db) { foreach ($args as $attribute => $content) { - $set_ = 'set_' . $attribute; + $set_ = 'set_' . trim($attribute); $this->entity->$set_( $content ); } @@ -80,7 +82,7 @@ class Entity_Factory { } elseif (!empty($args) && !$is_validated_and_in_db){ foreach ($args as $attribute => $content) { - $set_ = 'set_' . $attribute; + $set_ = 'set_' . trim($attribute); $this->entity->$set_( $content ); } diff --git a/tests/test-taxonomies.php b/tests/test-taxonomies.php index 1136a6555..847aa054a 100644 --- a/tests/test-taxonomies.php +++ b/tests/test-taxonomies.php @@ -264,13 +264,11 @@ class Taxonomies extends TAINACAN_UnitTestCase { 'taxonomy', array( 'name' => 'genero', - //'enabled_post_types ' => ['post'] + 'enabled_post_types' => ['post'] ), true ); - - $taxonomy->set('enabled_post_types', ['post']); - + $taxonomy = $Tainacan_Taxonomies->insert($taxonomy); $pto = get_object_taxonomies('post');