Skip to content

Commit

Permalink
SanitizePost::test_int_fields(): remove use of assertInternalType()
Browse files Browse the repository at this point in the history
Removes the `$int_fields` array and the loop in favour of plain assertions.
  • Loading branch information
jrfnl committed Aug 16, 2020
1 parent af9ded0 commit 6ff409a
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions tests/phpunit/tests/formatting/SanitizePost.php
Expand Up @@ -9,17 +9,12 @@ class Tests_Formatting_SanitizePost extends WP_UnitTestCase {
* @ticket 22324
*/
function test_int_fields() {
$post = self::factory()->post->create_and_get();
$int_fields = array(
'ID' => 'integer',
'post_parent' => 'integer',
'menu_order' => 'integer',
'post_author' => 'string',
'comment_count' => 'string',
);
$post = self::factory()->post->create_and_get();

foreach ( $int_fields as $field => $type ) {
$this->assertInternalType( $type, $post->$field, "field $field" );
}
$this->assertIsInt( $post->ID, 'field ID' );
$this->assertIsInt( $post->post_parent, 'field post_parent' );
$this->assertIsInt( $post->menu_order, 'field menu_order' );
$this->assertIsString( $post->post_author, 'field post_author' );
$this->assertIsString( $post->comment_count, 'field comment_count' );
}
}

0 comments on commit 6ff409a

Please sign in to comment.