From a9bcd0292aec84857e8328763d50d48846ba2306 Mon Sep 17 00:00:00 2001 From: Jacson Passold Date: Mon, 29 Jan 2018 18:18:40 -0200 Subject: [PATCH] better handler response errors --- tests/test-api-collections.php | 2 +- tests/test-api-filters.php | 2 +- tests/test-api-metadata.php | 2 +- tests/test-api-taxonomies.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test-api-collections.php b/tests/test-api-collections.php index f572101f2..7cbad5239 100644 --- a/tests/test-api-collections.php +++ b/tests/test-api-collections.php @@ -39,7 +39,7 @@ class TAINACAN_REST_Collections_Controller extends TAINACAN_UnitApiTestCase { $request->set_body($collection_JSON); $response = $this->server->dispatch( $request ); - $this->assertEquals( 201, $response->get_status() ); + $this->assertEquals( 201, $response->get_status(), sprintf('response: %s', print_r($response, true)) ); $collection = $response->get_data(); $id = $collection['id']; diff --git a/tests/test-api-filters.php b/tests/test-api-filters.php index 3c8d0e65e..aa68296ac 100644 --- a/tests/test-api-filters.php +++ b/tests/test-api-filters.php @@ -44,7 +44,7 @@ class TAINACAN_REST_Terms_Controller extends TAINACAN_UnitApiTestCase { $response = $this->server->dispatch($request); $data = $response->get_data(); - + $this->assertTrue(is_array($data) && array_key_exists('filter_type', $data), sprintf('cannot create a range, response: %s', print_r($data, true))); $this->assertEquals('Tainacan\Filter_Types\Range', $data['filter_type']); $this->assertEquals('Filter name', $data['name']); } diff --git a/tests/test-api-metadata.php b/tests/test-api-metadata.php index ebc001bb2..da0079241 100644 --- a/tests/test-api-metadata.php +++ b/tests/test-api-metadata.php @@ -41,7 +41,7 @@ class TAINACAN_REST_Metadata_Controller extends TAINACAN_UnitApiTestCase { $response = $this->server->dispatch($request); $metadata_added = $response->get_data(); - + $this->assertTrue(is_array($metadata_added) && array_key_exists('name', $metadata_added), sprintf('cannot create metadata, response: %s', print_r($metadata_added, true))); $this->assertEquals('Moeda', $metadata_added['name']); } diff --git a/tests/test-api-taxonomies.php b/tests/test-api-taxonomies.php index ce3d9f19a..39a6a8ced 100644 --- a/tests/test-api-taxonomies.php +++ b/tests/test-api-taxonomies.php @@ -65,7 +65,7 @@ class TAINACAN_REST_Taxonomies_Controller extends TAINACAN_UnitApiTestCase { $response = $this->server->dispatch($request); $data = $response->get_data(); - + $this->assertTrue(is_array($data) && array_key_exists('name', $data), sprintf('cannot create a range, response: %s', print_r($data, true))); $this->assertEquals('Nome', $data['name']); }