-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Sidebars endpoint] Add permissions PHPUnit tests #24784
Conversation
…th the sidebars endpoint
Size Change: +2.43 kB (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything is green, let's make it more green.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding these! I left some feedback.
@@ -6,6 +6,15 @@ | |||
* @subpackage REST_API | |||
*/ | |||
|
|||
require_once dirname( __FILE__ ) . '/../lib/class-wp-rest-sidebars-controller.php'; | |||
add_filter( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add_filter( | |
add_action( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why do we need to include this here at all? If it is because the endpoint is in an experiment, I think we should do the same thing we did as the block directory and enable the experiment in the tests
tellyworth@26363cf#diff-85d18a6eb126c0f8c8da280e74555a2c
In phpunit/bootstrap.php
.
$GLOBALS['wp_tests_options'] = array(
'gutenberg-experiments' => array(
'gutenberg-block-directory' => '1',
),
);
@@ -407,4 +457,11 @@ public function test_get_item_schema() { | |||
$this->assertArrayHasKey( 'status', $properties ); | |||
$this->assertArrayHasKey( 'widgets', $properties ); | |||
} | |||
|
|||
public function users_without_permissions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this is working as expected? As far as I know, data providers are executed before setup before class, which means that the ids haven't been created yet. This is probably why the tests are passing when checking for a 401
.
Co-authored-by: Timothy Jacobs <[email protected]>
Co-authored-by: Timothy Jacobs <[email protected]>
Co-authored-by: Timothy Jacobs <[email protected]>
Co-authored-by: Timothy Jacobs <[email protected]>
Co-authored-by: Timothy Jacobs <[email protected]>
…utenberg into update/phpunit-widget-screen
All good notes @TimothyBJacobs, I just addressed your comments, would you mind re-reviewing? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me!
Description
This PR adds coverage for when the user is logged out or has insufficient permissions as per #24290 (review).
How has this been tested?
Confirm all checks pass on this PR.
Types of changes
Non-breaking change
Checklist: