mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Tests: Correctly restore the wp_installing() status in Ajax tests.
In the tests for updating a plugin or theme via Ajax, `wp_installing( true )` was called to prevent `wp_update_plugins()` or `wp_update_themes()` from running.
Since the subsequent `wp_installing( false )` call was in the same `try { ... }` block, it could not be executed if an exception was thrown, affecting other tests.
In this case, after rearranging the Ajax tests in [54722], this started affecting the `get_site_option()` calls in the tests for `wp_ajax_wp_compression_test()`.
By moving both `wp_installing()` calls out of the `try`/`catch` block, we can ensure the status is correctly restored.
Follow-up to [734/tests], [37150], [38168], [38710], [54722].
See #56793.
git-svn-id: https://develop.svn.wordpress.org/trunk@54723 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
54eca75d04
commit
ce0f682d04
@ -141,16 +141,18 @@ class Tests_Ajax_wpAjaxUpdatePlugin extends WP_Ajax_UnitTestCase {
|
||||
$_POST['plugin'] = 'hello.php';
|
||||
$_POST['slug'] = 'hello-dolly';
|
||||
|
||||
// Prevent wp_update_plugins() from running.
|
||||
wp_installing( true );
|
||||
|
||||
// Make the request.
|
||||
try {
|
||||
// Prevent wp_update_plugins() from running.
|
||||
wp_installing( true );
|
||||
$this->_handleAjax( 'update-plugin' );
|
||||
wp_installing( false );
|
||||
} catch ( WPAjaxDieContinueException $e ) {
|
||||
unset( $e );
|
||||
}
|
||||
|
||||
wp_installing( false );
|
||||
|
||||
// Get the response.
|
||||
$response = json_decode( $this->_last_response, true );
|
||||
|
||||
|
||||
@ -112,18 +112,18 @@ class Tests_Ajax_wpAjaxUpdateTheme extends WP_Ajax_UnitTestCase {
|
||||
$_POST['_ajax_nonce'] = wp_create_nonce( 'updates' );
|
||||
$_POST['slug'] = 'twentyten';
|
||||
|
||||
// Prevent wp_update_themes() from running.
|
||||
wp_installing( true );
|
||||
|
||||
// Make the request.
|
||||
try {
|
||||
|
||||
// Prevent wp_update_themes() from running.
|
||||
wp_installing( true );
|
||||
$this->_handleAjax( 'update-theme' );
|
||||
wp_installing( false );
|
||||
|
||||
} catch ( WPAjaxDieContinueException $e ) {
|
||||
unset( $e );
|
||||
}
|
||||
|
||||
wp_installing( false );
|
||||
|
||||
// Get the response.
|
||||
$response = json_decode( $this->_last_response, true );
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user