wordpress-develop/tests/phpunit/tests/formatting/sanitizePost.php
Sergey Biryukov 18f244c440 Tests: Move some @covers tags in the formatting group to the class DocBlock.
This aims to bring more consistency, as these test classes typically cover a single function, unless noted otherwise.

Follow-up to [53562], [53571], [54051].

See #56793.

git-svn-id: https://develop.svn.wordpress.org/trunk@54728 602fd350-edb4-49c9-b593-d223f7449a82
2022-10-31 13:54:00 +00:00

36 lines
754 B
PHP

<?php
/**
* @group formatting
* @group post
*
* @covers ::sanitize_post
* @covers WP_Post::__construct
*/
class Tests_Formatting_SanitizePost extends WP_UnitTestCase {
/**
* @ticket 22324
*/
public 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',
);
foreach ( $int_fields as $field => $type ) {
switch ( $type ) {
case 'integer':
$this->assertIsInt( $post->$field, "field $field" );
break;
case 'string':
$this->assertIsString( $post->$field, "field $field" );
break;
}
}
}
}