- Timestamp:
- 01/17/2019 09:24:47 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-users-controller.php
r44584 r44641 1492 1492 $this->assertInstanceOf( 'WP_Error', $response->as_error() ); 1493 1493 $this->assertEquals( 'rest_user_invalid_email', $response->as_error()->get_error_code() ); 1494 } 1495 1496 /** 1497 * @ticket 44672 1498 */ 1499 public function test_update_item_existing_email_case() { 1500 wp_set_current_user( self::$editor ); 1501 1502 $user = get_userdata( self::$editor ); 1503 1504 $updated_email_with_case_change = ucwords( $user->user_email, '@' ); 1505 1506 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$editor ) ); 1507 $request->set_param( 'email', $updated_email_with_case_change ); 1508 $response = rest_get_server()->dispatch( $request ); 1509 $data = $response->get_data(); 1510 1511 $this->assertEquals( 200, $response->get_status() ); 1512 $this->assertEquals( $updated_email_with_case_change, $data['email'] ); 1513 } 1514 1515 /** 1516 * @ticket 44672 1517 */ 1518 public function test_update_item_existing_email_case_not_own() { 1519 wp_set_current_user( self::$editor ); 1520 1521 $user = get_userdata( self::$editor ); 1522 $subscriber = get_userdata( self::$subscriber ); 1523 1524 $updated_email_with_case_change = ucwords( $subscriber->user_email, '@' ); 1525 1526 $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/users/%d', self::$editor ) ); 1527 $request->set_param( 'email', $updated_email_with_case_change ); 1528 $response = rest_get_server()->dispatch( $request ); 1529 $data = $response->get_data(); 1530 1531 $this->assertEquals( 400, $response->get_status() ); 1532 $this->assertSame( 'rest_user_invalid_email', $data['code'] ); 1494 1533 } 1495 1534
Note: See TracChangeset
for help on using the changeset viewer.