mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Update the `wp_die_handler()` method to pass the response into `WPDieException` so that `expectExceptionCode()` calls work as expected. Follow-up to [1221/tests], [3934], [4009], [12309]. Props pbearne, jrf, mukesh27. Fixes #53882. git-svn-id: https://develop.svn.wordpress.org/trunk@51608 602fd350-edb4-49c9-b593-d223f7449a82
35 lines
856 B
PHP
35 lines
856 B
PHP
<?php
|
|
|
|
/**
|
|
* Tests for the wp_nonce_ays() function.
|
|
*
|
|
* @since 5.9.0
|
|
*
|
|
* @group functions.php
|
|
* @covers ::wp_nonce_ays
|
|
*/
|
|
class Tests_Functions_wpNonceAys extends WP_UnitTestCase {
|
|
|
|
/**
|
|
* @ticket 53882
|
|
*/
|
|
public function test_wp_nonce_ays() {
|
|
$this->expectException( 'WPDieException' );
|
|
$this->expectExceptionMessage( 'The link you followed has expired.' );
|
|
$this->expectExceptionCode( 403 );
|
|
|
|
wp_nonce_ays( 'random_string' );
|
|
}
|
|
|
|
/**
|
|
* @ticket 53882
|
|
*/
|
|
public function test_wp_nonce_ays_log_out() {
|
|
$this->expectException( 'WPDieException' );
|
|
$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&_wpnonce=.{10}">log out</a>\?#m' );
|
|
$this->expectExceptionCode( 403 );
|
|
|
|
wp_nonce_ays( 'log-out' );
|
|
}
|
|
}
|