diff --git a/tests/phpunit/tests/comment/template.php b/tests/phpunit/tests/comment/template.php index 22283a5c2e..68f98b5c8b 100644 --- a/tests/phpunit/tests/comment/template.php +++ b/tests/phpunit/tests/comment/template.php @@ -3,24 +3,9 @@ * @group comment */ class Tests_Comment_Template extends WP_UnitTestCase { - /** - * Shared post ID. - * - * @var int - */ - public static $post_id; - - /** - * Set up shared fixtures. - * - * @param WP_UnitTest_Factory $factory Unit test factory. - */ - function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) { - self::$post_id = self::factory()->post->create(); - } function test_get_comments_number() { - $post_id = self::$post_id; + $post_id = self::factory()->post->create(); $this->assertSame( 0, get_comments_number( 0 ) ); $this->assertSame( '0', get_comments_number( $post_id ) ); @@ -33,7 +18,7 @@ class Tests_Comment_Template extends WP_UnitTestCase { } function test_get_comments_number_without_arg() { - $post_id = self::$post_id; + $post_id = self::factory()->post->create(); $permalink = get_permalink( $post_id ); $this->go_to( $permalink ); @@ -49,7 +34,7 @@ class Tests_Comment_Template extends WP_UnitTestCase { * @ticket 48772 */ function test_get_comments_number_text_with_post_id() { - $post_id = self::$post_id; + $post_id = $this->factory->post->create(); $this->factory->comment->create_post_comments( $post_id, 6 ); $comments_number_text = get_comments_number_text( false, false, false, $post_id ); @@ -68,7 +53,7 @@ class Tests_Comment_Template extends WP_UnitTestCase { * @ticket 13651 */ function test_get_comments_number_text_declension_with_default_args() { - $post_id = self::$post_id; + $post_id = $this->factory->post->create(); $permalink = get_permalink( $post_id ); $this->go_to( $permalink ); @@ -91,7 +76,7 @@ class Tests_Comment_Template extends WP_UnitTestCase { * @dataProvider data_get_comments_number_text_declension */ function test_get_comments_number_text_declension_with_custom_args( $number, $input, $output ) { - $post_id = self::$post_id; + $post_id = $this->factory->post->create(); $permalink = get_permalink( $post_id ); $this->factory->comment->create_post_comments( $post_id, $number );