From 7747778a806124355de8f2794427c736130ad77d Mon Sep 17 00:00:00 2001 From: leogermani Date: Tue, 5 Nov 2019 11:50:57 -0300 Subject: [PATCH] add test to get roles endpoint #274 --- tests/test-api-roles.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/test-api-roles.php b/tests/test-api-roles.php index 772eddd0d..319036d3b 100644 --- a/tests/test-api-roles.php +++ b/tests/test-api-roles.php @@ -130,6 +130,21 @@ class TAINACAN_REST_Roles_Controller extends TAINACAN_UnitApiTestCase { } + public function test_get_roles() { + $request = new \WP_REST_Request('GET', $this->namespace . '/roles'); + + $response = $this->server->dispatch($request); + + $this->assertEquals( 200, $response->get_status() ); + + $data = $response->get_data(); + + foreach (\tainacan_roles()->get_tainacan_roles() as $role => $r) { + $this->assertArrayHasKey($role, $data); + } + + } + public function test_add_dependencies() { $request = new \WP_REST_Request('POST', $this->namespace . '/roles');