Tests: Use more appropriate assertions in various tests.

This replaces instances of `assertTrue( ... > 0 )` with `assertGreaterThan()` to use native PHPUnit functionality.

Follow-up to [51335], [51337], [51367], [51397], [51403], [51404], [51436], [51438], [51448], [51449], [51451], [51453].

See #53363.

git-svn-id: https://develop.svn.wordpress.org/trunk@51454 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2021-07-18 14:10:24 +00:00
parent ba94d9b67b
commit 4a533f4879
10 changed files with 36 additions and 33 deletions
+6 -5
View File
@@ -80,7 +80,7 @@ class Tests_Post extends WP_UnitTestCase {
// Insert a post and make sure the ID is OK.
$id = wp_insert_post( $post );
$this->assertIsNumeric( $id );
$this->assertTrue( $id > 0 );
$this->assertGreaterThan( 0, $id );
// Fetch the post and make sure it matches.
$out = get_post( $id );
@@ -136,7 +136,7 @@ class Tests_Post extends WP_UnitTestCase {
$this->post_ids[] = $id;
// dmp( _get_cron_array() );
$this->assertIsNumeric( $id );
$this->assertTrue( $id > 0 );
$this->assertGreaterThan( 0, $id );
// Fetch the post and make sure it matches.
$out = get_post( $id );
@@ -259,7 +259,7 @@ class Tests_Post extends WP_UnitTestCase {
$this->post_ids[] = $id;
// dmp( _get_cron_array() );
$this->assertIsNumeric( $id );
$this->assertTrue( $id > 0 );
$this->assertGreaterThan( 0, $id );
// Fetch the post and make sure it matches.
$out = get_post( $id );
@@ -380,7 +380,7 @@ class Tests_Post extends WP_UnitTestCase {
$this->post_ids[] = $id;
// dmp( _get_cron_array() );
$this->assertIsNumeric( $id );
$this->assertTrue( $id > 0 );
$this->assertGreaterThan( 0, $id );
// Fetch the post and make sure it matches.
$out = get_post( $id );
@@ -793,7 +793,8 @@ class Tests_Post extends WP_UnitTestCase {
),
);
$insert_post_id = wp_insert_post( $post_data, true, true );
$this->assertTrue( ( is_int( $insert_post_id ) && $insert_post_id > 0 ) );
$this->assertIsInt( $insert_post_id );
$this->assertGreaterThan( 0, $insert_post_id );
$post = get_post( $insert_post_id );
$this->assertEquals( $post->post_author, self::$editor_id );