Skip to content
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

phpunit test for wp_nonce_ays AND UPDATE CODE for wp_die_handler to p… #1549

Closed
wants to merge 5 commits into from

Conversation

pbearne
Copy link

@pbearne pbearne commented Aug 5, 2021

tests for wp_nonce_ays
AND UPDATE CODE for wp_die_handler to pass the response into WPDieException so that expectExceptionCode() call work

Trac ticket: https://core.trac.wordpress.org/ticket/53882

*/
public function test_wp_nonce_ays_log_out() {
$this->expectException( 'WPDieException' );
$this->expectExceptionMessageRegExp( '/You are attempting to log out of Test Blog<\/p><p>Do you really want to <a href="http:\/\/example\.org\/wp-login\.php\?action=logout&amp;_wpnonce=.{10}">log out<\/a>\?/m' );
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->expectExceptionMessageRegExp( '/You are attempting to log out of Test Blog<\/p><p>Do you really want to <a href="http:\/\/example\.org\/wp-login\.php\?action=logout&amp;_wpnonce=.{10}">log out<\/a>\?/m' );
$this->expectExceptionMessageMatches( '/You are attempting to log out of Test Blog<\/p><p>Do you really want to <a href="http:\/\/example\.org\/wp-login\.php\?action=logout&amp;_wpnonce=.{10}">log out<\/a>\?/m' );

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test suite has been upgraded for better PHPUnit cross-version compatibility. You can now use all PHPUnit 9.x assertion and expectation methods and the tests will still work on PHPUnit 5.x - 9.x.
For more details, see https://core.trac.wordpress.org/ticket/46149

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw that the tests were failing and fixed already

@SergeyBiryukov
Copy link
Member

Thanks for the PR! Merged in https://core.trac.wordpress.org/changeset/51608.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants