From 94d6ca8dc6d3acbae7aa86ce59714e4024c3d9e1 Mon Sep 17 00:00:00 2001 From: weryques Date: Tue, 12 Dec 2017 12:16:17 -0200 Subject: [PATCH] Removed unecessary verification --- tests/factories/class-tainacan-entity-factory.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/tests/factories/class-tainacan-entity-factory.php b/tests/factories/class-tainacan-entity-factory.php index af83ec922..e270dbf50 100644 --- a/tests/factories/class-tainacan-entity-factory.php +++ b/tests/factories/class-tainacan-entity-factory.php @@ -75,7 +75,7 @@ class Entity_Factory { if ($this->entity->validate()) { $this->entity = $this->repository->insert($this->entity); } else { - throw new \ErrorException('The entity wasn\'t validated.'); + throw new \ErrorException('The entity wasn\'t validated.' . print_r( $this->entity->get_errors(), true)); } } elseif (!empty($args) && !$is_validated_and_in_db){ @@ -108,12 +108,8 @@ class Entity_Factory { $this->entity->set_description( 'It is only for test' ); } - if ($this->entity->validate()) { - $this->entity = $this->repository->insert( $this->entity ); - } else { - throw new \ErrorException('The entity wasn\'t validated.' . print_r( $this->entity->get_errors(), true)); - } - + $this->entity->validate(); + $this->entity = $this->repository->insert( $this->entity ); } else { throw new \InvalidArgumentException('One or more arguments are invalid.'); }