From 9a2078dd19421ebb91812ff69bf08d10da057e36 Mon Sep 17 00:00:00 2001 From: leogermani Date: Mon, 11 Nov 2019 14:57:30 -0300 Subject: [PATCH] fix roles_inherited return #274 --- src/api/endpoints/class-tainacan-rest-roles-controller.php | 1 + tests/test-api-roles.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/src/api/endpoints/class-tainacan-rest-roles-controller.php b/src/api/endpoints/class-tainacan-rest-roles-controller.php index d4f26d023..8c42797a1 100644 --- a/src/api/endpoints/class-tainacan-rest-roles-controller.php +++ b/src/api/endpoints/class-tainacan-rest-roles-controller.php @@ -432,6 +432,7 @@ class REST_Roles_Controller extends REST_Controller { 'slug' => $slug, 'name' => translate_user_role($role['name']), ]; + continue; } // inherited roles diff --git a/tests/test-api-roles.php b/tests/test-api-roles.php index 3c4414192..3e7c0cf62 100644 --- a/tests/test-api-roles.php +++ b/tests/test-api-roles.php @@ -238,6 +238,9 @@ class TAINACAN_REST_Roles_Controller extends TAINACAN_UnitApiTestCase { $this->assertArrayHasKey('test', $caps['tnc_rep_edit_metadata']['roles']); $this->assertArrayHasKey('editor', $caps['tnc_rep_edit_metadata']['roles_inherited']); + $this->assertArrayNotHasKey('editor', $caps['manage_tainacan']['roles_inherited']); + $this->assertArrayNotHasKey('administrator', $caps['manage_tainacan']['roles_inherited']); + }