From 80a345f5b28192e90abc36986933ca7a09a9496a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 24 Sep 2021 00:29:46 +0000 Subject: [PATCH] Tests: Further improve the tests for `avoid_blog_page_permalink_collision()`: * Rename the test filename and class to match the name of the function being tested. * Remove unnecessary `setUp()` and `tearDown()` methods. * Replace the `only` test group with `post`. Follow-up to [51855-51857]. See #51147. git-svn-id: https://develop.svn.wordpress.org/trunk@51859 602fd350-edb4-49c9-b593-d223f7449a82 --- ...hp => avoidBlogPagePermalinkCollision.php} | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) rename tests/phpunit/tests/multisite/{msPermalinkCollision.php => avoidBlogPagePermalinkCollision.php} (81%) diff --git a/tests/phpunit/tests/multisite/msPermalinkCollision.php b/tests/phpunit/tests/multisite/avoidBlogPagePermalinkCollision.php similarity index 81% rename from tests/phpunit/tests/multisite/msPermalinkCollision.php rename to tests/phpunit/tests/multisite/avoidBlogPagePermalinkCollision.php index 794edab6a9..137dff5b79 100644 --- a/tests/phpunit/tests/multisite/msPermalinkCollision.php +++ b/tests/phpunit/tests/multisite/avoidBlogPagePermalinkCollision.php @@ -6,10 +6,9 @@ if ( is_multisite() ) : * Tests specific to `avoid_blog_page_permalink_collision()` in multisite. * * @group multisite - * @group only + * @group post */ - class Tests_Multisite_MS_Permalink_Collision extends WP_UnitTestCase { - protected $suppress = false; + class Tests_Multisite_AvoidBlogPagePermalinkCollision extends WP_UnitTestCase { protected static $site_id; protected static $root_page; protected static $child_page; @@ -53,24 +52,12 @@ if ( is_multisite() ) : wp_delete_post( self::$child_page->ID ); } - public function set_up() { - global $wpdb; - parent::set_up(); - $this->suppress = $wpdb->suppress_errors(); - } - - public function tear_down() { - global $wpdb; - $wpdb->suppress_errors( $this->suppress ); - parent::tear_down(); - } - public function test_avoid_blog_page_permalink_collision_renames_post_name() { $this->assertNotSame( self::$post_and_blog_path, self::$root_page->post_name ); } /** - * Ensure `avoid_blog_page_permalink_collision()` doesn't rename child pages post_name. + * Ensure `avoid_blog_page_permalink_collision()` doesn't rename child pages' post_name. * * @ticket 51147 */