Skip to content

Commit

Permalink
More test fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyBJacobs committed Nov 8, 2021
1 parent 558ddcb commit 15f71c4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,14 @@ protected function handle_locations( $menu_id, $request ) {
$new_locations = array();
foreach ( $request['locations'] as $location ) {
if ( ! in_array( $location, $menu_locations, true ) ) {
return new WP_Error( 'invalid_menu_location', __( 'Menu location does not exist.' ), array( 'status' => 400 ) );
return new WP_Error(
'rest_invalid_menu_location',
__( 'Invalid menu location.' ),
array(
'status' => 400,
'location' => $location,
)
);
}
$new_locations[ $location ] = $menu_id;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/phpunit/tests/rest-api/rest-taxonomies-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ public function test_get_items_context_edit() {
$request->set_param( 'context', 'edit' );
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$taxonomies = $this->get_public_taxonomies( get_taxonomies( '', 'objects' ) );
$taxonomies = get_taxonomies( '', 'objects' );
unset( $taxonomies['nav_menu'] ); // Menus are not editable by contributors.
$taxonomies = $this->get_public_taxonomies( $taxonomies );
$this->assertSame( count( $taxonomies ), count( $data ) );
$this->assertSame( 'Categories', $data['category']['name'] );
$this->assertSame( 'category', $data['category']['slug'] );
Expand Down

0 comments on commit 15f71c4

Please sign in to comment.