From 511e4c67dde213aba1d955c93a2bc141fca9ad7e Mon Sep 17 00:00:00 2001 From: Rachel Baker Date: Mon, 2 Jan 2017 18:42:22 +0000 Subject: [PATCH] REST API: Add missing assertions to the view and embed context response data for the Users Controller. Adds tests for responses where `context != 'edit'` the following properties are not included in the response data: - `email` - `locale` - `registered_date` Props thepelkus, jnylen0. Fixes #39399. git-svn-id: https://develop.svn.wordpress.org/trunk@39660 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/rest-api/rest-users-controller.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/phpunit/tests/rest-api/rest-users-controller.php b/tests/phpunit/tests/rest-api/rest-users-controller.php index 4f5edcf35a..ba101e79d8 100644 --- a/tests/phpunit/tests/rest-api/rest-users-controller.php +++ b/tests/phpunit/tests/rest-api/rest-users-controller.php @@ -2111,12 +2111,14 @@ class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { if ( 'edit' !== $context ) { $this->assertArrayNotHasKey( 'roles', $data ); $this->assertArrayNotHasKey( 'capabilities', $data ); - $this->assertArrayNotHasKey( 'registered', $data ); + $this->assertArrayNotHasKey( 'registered_date', $data ); $this->assertArrayNotHasKey( 'first_name', $data ); $this->assertArrayNotHasKey( 'last_name', $data ); $this->assertArrayNotHasKey( 'nickname', $data ); + $this->assertArrayNotHasKey( 'email', $data ); $this->assertArrayNotHasKey( 'extra_capabilities', $data ); $this->assertArrayNotHasKey( 'username', $data ); + $this->assertArrayNotHasKey( 'locale', $data ); } $this->assertEqualSets( array(