Skip to content

Commit

Permalink
Assert zero errors in Direct DB tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ernilambar committed Jan 3, 2024
1 parent 1a8a54c commit 7fa609b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@
*
* @package test-plugin-direct-db-queries-without-errors
*/

global $wpdb;

echo $wpdb->insert_id;
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ public function test_run_with_errors() {
$check->run( $check_result );

$warnings = $check_result->get_warnings();
$errors = $check_result->get_errors();

$this->assertNotEmpty( $warnings );
$this->assertArrayHasKey( 'load.php', $warnings );
$this->assertEquals( 6, $check_result->get_warning_count() );
$this->assertEmpty( $errors );
$this->assertEquals( 0, $check_result->get_error_count() );
}

public function test_run_without_errors() {
Expand All @@ -32,9 +35,9 @@ public function test_run_without_errors() {

$check->run( $check_result );

$warnings = $check_result->get_warnings();

$this->assertEmpty( $warnings );
$this->assertEmpty( $check_result->get_warnings() );
$this->assertEmpty( $check_result->get_errors() );
$this->assertEquals( 0, $check_result->get_warning_count() );
$this->assertEquals( 0, $check_result->get_error_count() );
}
}

0 comments on commit 7fa609b

Please sign in to comment.