From 253308253b358d40c58f38688b6e3ecfdc2c8507 Mon Sep 17 00:00:00 2001 From: Aaron Jorbin Date: Wed, 30 Mar 2016 19:52:14 +0000 Subject: [PATCH] Adjust unit tests to account for change in [37144] git-svn-id: https://develop.svn.wordpress.org/trunk@37150 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/ajax/Compression.php | 30 ++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/phpunit/tests/ajax/Compression.php b/tests/phpunit/tests/ajax/Compression.php index 475c206807..d82e0c54b9 100644 --- a/tests/phpunit/tests/ajax/Compression.php +++ b/tests/phpunit/tests/ajax/Compression.php @@ -143,7 +143,20 @@ class Tests_Ajax_CompressionTest extends WP_Ajax_UnitTestCase { unset( $e ); } - // Check the site option + // Check the site option is not changed due to lack of nonce + $this->assertEquals( 0, get_site_option( 'can_compress_scripts' ) ); + + // Add a nonce + $_GET['_ajax_nonce'] = wp_create_nonce( 'update_can_compress_scripts' ); + + // Retry the request + try { + $this->_handleAjax( 'wp-compression-test' ); + } catch ( WPAjaxDieStopException $e ) { + unset( $e ); + } + + // Check the site option is changed $this->assertEquals( 1, get_site_option( 'can_compress_scripts' ) ); } @@ -168,7 +181,20 @@ class Tests_Ajax_CompressionTest extends WP_Ajax_UnitTestCase { unset( $e ); } - // Check the site option + // Check the site option is not changed due to lack of nonce + $this->assertEquals( 1, get_site_option( 'can_compress_scripts' ) ); + + // Add a nonce + $_GET['_ajax_nonce'] = wp_create_nonce( 'update_can_compress_scripts' ); + + // Retry the request + try { + $this->_handleAjax( 'wp-compression-test' ); + } catch ( WPAjaxDieStopException $e ) { + unset( $e ); + } + + // Check the site option is changed $this->assertEquals( 0, get_site_option( 'can_compress_scripts' ) ); }