From 625207e8cac3be6d90c9bf0d7fd6f92654d02c29 Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Wed, 6 Dec 2023 16:51:56 -0500 Subject: [PATCH 1/2] Upgrading testkit to 0.12, coding standards to 2 --- composer.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/composer.json b/composer.json index 1be58d5c..358940e6 100644 --- a/composer.json +++ b/composer.json @@ -23,9 +23,9 @@ "composer/installers": "^1.0" }, "require-dev": { - "alleyinteractive/alley-coding-standards": "^1.0", + "alleyinteractive/alley-coding-standards": "^2.0", "friendsofphp/php-cs-fixer": "^3.8", - "mantle-framework/testkit": "^0.11" + "mantle-framework/testkit": "^0.12" }, "scripts": { "fixer": "php-cs-fixer -v fix --allow-risky=yes", From 5a884e57330541764dcb59ecd3e87788949129fd Mon Sep 17 00:00:00 2001 From: Sean Fisher Date: Wed, 6 Dec 2023 16:52:06 -0500 Subject: [PATCH 2/2] Upgrading coding standards, fixing external request --- .../alleyvate/features/class-disable-dashboard-widgets.php | 1 - tests/alley/wp/alleyvate/features/test-clean-admin-bar.php | 3 --- tests/alley/wp/alleyvate/features/test-disable-comments.php | 4 ++-- .../alleyvate/features/test-disable-dashboard-widgets.php | 3 +++ .../wp/alleyvate/features/test-disable-sticky-posts.php | 6 +++--- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/alley/wp/alleyvate/features/class-disable-dashboard-widgets.php b/src/alley/wp/alleyvate/features/class-disable-dashboard-widgets.php index d9642c24..75cdac64 100644 --- a/src/alley/wp/alleyvate/features/class-disable-dashboard-widgets.php +++ b/src/alley/wp/alleyvate/features/class-disable-dashboard-widgets.php @@ -59,5 +59,4 @@ public function action__disable_dashboard_widgets() { remove_meta_box( $widget['id'], 'dashboard', $widget['context'] ); } } - } diff --git a/tests/alley/wp/alleyvate/features/test-clean-admin-bar.php b/tests/alley/wp/alleyvate/features/test-clean-admin-bar.php index e68b38d2..c3a5d0b9 100644 --- a/tests/alley/wp/alleyvate/features/test-clean-admin-bar.php +++ b/tests/alley/wp/alleyvate/features/test-clean-admin-bar.php @@ -68,7 +68,6 @@ public function test_remove_admin_bar_nodes() { foreach ( $disposable_nodes as $disposable_node ) { $this->assertArrayNotHasKey( $disposable_node, $current_nodes, $disposable_node . ' should not exist in $wp_admin_bar global after boot.' ); } - } /** @@ -102,7 +101,6 @@ function ( $disposable_nodes ) use ( $node ) { $current_nodes = $admin_bar->get_nodes(); $this->assertArrayNotHasKey( $node, $current_nodes, 'The filtered node ' . $node . ' should not exist in $wp_admin_bar global after boot.' ); - } /** @@ -122,5 +120,4 @@ public function apply_admin_bar() { return $wp_admin_bar; } - } diff --git a/tests/alley/wp/alleyvate/features/test-disable-comments.php b/tests/alley/wp/alleyvate/features/test-disable-comments.php index a3fef433..01275d3f 100644 --- a/tests/alley/wp/alleyvate/features/test-disable-comments.php +++ b/tests/alley/wp/alleyvate/features/test-disable-comments.php @@ -19,8 +19,8 @@ * Tests for fully disabling comment functionality. */ final class Test_Disable_Comments extends Test_Case { - use \Mantle\Testing\Concerns\Admin_Screen, - \Mantle\Testing\Concerns\Refresh_Database; + use \Mantle\Testing\Concerns\Admin_Screen; + use \Mantle\Testing\Concerns\Refresh_Database; /** * Feature instance. diff --git a/tests/alley/wp/alleyvate/features/test-disable-dashboard-widgets.php b/tests/alley/wp/alleyvate/features/test-disable-dashboard-widgets.php index e5515dd5..7d9cae33 100644 --- a/tests/alley/wp/alleyvate/features/test-disable-dashboard-widgets.php +++ b/tests/alley/wp/alleyvate/features/test-disable-dashboard-widgets.php @@ -36,6 +36,9 @@ protected function setUp(): void { parent::setUp(); $this->feature = new Disable_Dashboard_Widgets(); + + $this->prevent_stray_requests(); + $this->fake_request(); } /** diff --git a/tests/alley/wp/alleyvate/features/test-disable-sticky-posts.php b/tests/alley/wp/alleyvate/features/test-disable-sticky-posts.php index c115ca5b..b7b1bcb5 100644 --- a/tests/alley/wp/alleyvate/features/test-disable-sticky-posts.php +++ b/tests/alley/wp/alleyvate/features/test-disable-sticky-posts.php @@ -44,8 +44,8 @@ protected function setUp(): void { */ public function test_disable_sticky_posts_in_query() { - $posts = static::factory()->post->create_ordered_set( 5 ); - $stick_post_id = static::factory()->post->create( + $posts = self::factory()->post->create_ordered_set( 5 ); + $stick_post_id = self::factory()->post->create( [ 'post_date' => '2019-01-01 00:00:00', ] @@ -90,7 +90,7 @@ public function test_disable_sticky_posts_in_query() { public function test_disable_action_sticky_rest_api_edit() { $this->acting_as( 'administrator' ); - $post_id = static::factory()->post->create(); + $post_id = self::factory()->post->create(); $this->get( rest_url( 'wp/v2/posts/' . $post_id . '?context=edit' ),