wordpress-develop/tests/phpunit/tests/formatting/sanitizePost.php
Andrew Ozz 5a3f8484d6 Build/Test Tools, Formatting group:
- Add and update @covers tags.
- Add and improve docs and inline comments.

Props pbeane, hellofromTonya, antonvlasenko, ironprogrammer, SergeyBiryukov, costdev.
See #39265.

git-svn-id: https://develop.svn.wordpress.org/trunk@53562 602fd350-edb4-49c9-b593-d223f7449a82
2022-06-23 20:27:34 +00:00

35 lines
727 B
PHP

<?php
/**
* @group formatting
* @group 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;
}
}
}
}