Skip to content

Commit

Permalink
test(wploadersuite) suppress wpdb errors to work around older WC acti…
Browse files Browse the repository at this point in the history
…vation issues
  • Loading branch information
lucatume committed Dec 11, 2023
1 parent 2b9b78e commit 5c6ece9
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tests/wploadersuite/AjaxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ public function testAjaxCallbackWillFailIfNumberNotOnlyOnceIsInvalid(): void
{
$response = null;
try {
global $wpdb;
$wpdb->suppress_errors = true; // Due to a WooCommerce activation issue in older versions.
$this->_handleAjax('test_ajax_action');
} catch (\WPAjaxDieContinueException) {
$response = json_decode($this->_last_response);
}

$wpdb->suppress_errors = false;

$this->assertNotNull($response);
$this->assertFalse($response->success);
$this->assertEquals('Number not only once is invalid', $response->data);
Expand Down

0 comments on commit 5c6ece9

Please sign in to comment.