diff --git a/tests/phpunit/integration/tests/Admin/Dashboard.php b/tests/phpunit/integration/tests/Admin/Dashboard.php index 886d0092026c..87ca01d19fab 100644 --- a/tests/phpunit/integration/tests/Admin/Dashboard.php +++ b/tests/phpunit/integration/tests/Admin/Dashboard.php @@ -18,6 +18,7 @@ namespace Google\Web_Stories\Tests\Integration\Admin; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Story_Post_Type; use Google\Web_Stories\Tests\Integration\Capabilities_Setup; @@ -188,7 +189,7 @@ public function test_enqueue_assets() { $this->createMock( \Google\Web_Stories\Locale::class ), ( new \Google\Web_Stories\Admin\Google_Fonts() ), $assets, - new Story_Post_Type( new Settings() ) + new Story_Post_Type( new Settings(), $experiments ) ); $this->instance->add_menu_page(); diff --git a/tests/phpunit/integration/tests/REST_API/Embed_Controller.php b/tests/phpunit/integration/tests/REST_API/Embed_Controller.php index 6f3649fadd9c..09d920ce91b9 100644 --- a/tests/phpunit/integration/tests/REST_API/Embed_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Embed_Controller.php @@ -102,7 +102,10 @@ public function set_up() { add_filter( 'pre_http_request', [ $this, 'mock_http_request' ], 10, 3 ); $this->request_count = 0; - $this->controller = new \Google\Web_Stories\REST_API\Embed_Controller( new Story_Post_Type( new Settings() ) ); + $settings = new Settings(); + $this->controller = new \Google\Web_Stories\REST_API\Embed_Controller( + new Story_Post_Type( $settings, new Experiments( $settings ) ) + ); } public function tear_down() { @@ -298,12 +301,11 @@ public function test_local_url_pretty_permalinks() { $this->set_permalink_structure( '/%postname%/' ); - $settings = new Settings(); - // Without (re-)registering the post type here there won't be any rewrite rules for it // and get_permalink() will return "http://example.org/?web-story=embed-controller-test-story" // instead of "http://example.org/web-stories/embed-controller-test-story/". // @todo Investigate why this is needed (leakage between tests?) + $settings = new Settings(); $story_post_type = new Story_Post_Type( $settings, new Experiments( $settings ) ); $story_post_type->register(); @@ -332,12 +334,11 @@ public function test_local_url_pretty_permalinks_multisite() { $this->set_permalink_structure( '/%postname%/' ); - $settings = new Settings(); - // Without (re-)registering the post type here there won't be any rewrite rules for it // and get_permalink() will return "http://example.org/?web-story=embed-controller-test-story" // instead of "http://example.org/web-stories/embed-controller-test-story/". // @todo Investigate why this is needed (leakage between tests?). + $settings = new Settings(); $story_post_type = new Story_Post_Type( $settings, new Experiments( $settings ) ); $story_post_type->register(); diff --git a/tests/phpunit/integration/tests/REST_API/Hotlinking_Controller.php b/tests/phpunit/integration/tests/REST_API/Hotlinking_Controller.php index bd4b01c33b0f..c808ef92b3d7 100644 --- a/tests/phpunit/integration/tests/REST_API/Hotlinking_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Hotlinking_Controller.php @@ -17,6 +17,7 @@ namespace Google\Web_Stories\Tests\Integration\REST_API; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Story_Post_Type; use WP_Error; @@ -79,8 +80,9 @@ public function set_up() { add_filter( 'pre_http_request', [ $this, 'mock_http_request' ], 10, 3 ); $this->request_count = 0; + $settings = new Settings(); $this->controller = new \Google\Web_Stories\REST_API\Hotlinking_Controller( - new Story_Post_Type( new Settings() ) + new Story_Post_Type( $settings, new Experiments( $settings ) ) ); } diff --git a/tests/phpunit/integration/tests/REST_API/Link_Controller.php b/tests/phpunit/integration/tests/REST_API/Link_Controller.php index 33fb67ae0ab7..fd3a6a79a2d7 100644 --- a/tests/phpunit/integration/tests/REST_API/Link_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Link_Controller.php @@ -2,6 +2,7 @@ namespace Google\Web_Stories\Tests\Integration\REST_API; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Story_Post_Type; use Google\Web_Stories\Tests\Integration\Test_REST_TestCase; @@ -67,7 +68,10 @@ public function set_up() { add_filter( 'pre_http_request', [ $this, 'mock_http_request' ], 10, 3 ); $this->request_count = 0; - $this->controller = new \Google\Web_Stories\REST_API\Link_Controller( new Story_Post_Type( new Settings() ) ); + $settings = new Settings(); + $this->controller = new \Google\Web_Stories\REST_API\Link_Controller( + new Story_Post_Type( $settings, new Experiments( $settings ) ) + ); } diff --git a/tests/phpunit/integration/tests/REST_API/Publisher_Logos_Controller.php b/tests/phpunit/integration/tests/REST_API/Publisher_Logos_Controller.php index 58f9a2d457bd..0a531d2f3597 100644 --- a/tests/phpunit/integration/tests/REST_API/Publisher_Logos_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Publisher_Logos_Controller.php @@ -2,6 +2,7 @@ namespace Google\Web_Stories\Tests\Integration\REST_API; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Tests\Integration\Story_Post_Type; use Google\Web_Stories\Tests\Integration\Test_REST_TestCase; @@ -94,7 +95,7 @@ public function set_up() { $settings = new Settings(); $this->controller = new \Google\Web_Stories\REST_API\Publisher_Logos_Controller( $settings, - new \Google\Web_Stories\Story_Post_Type( $settings ) + new \Google\Web_Stories\Story_Post_Type( $settings, new Experiments( $settings ) ) ); } diff --git a/tests/phpunit/integration/tests/REST_API/Status_Check_Controller.php b/tests/phpunit/integration/tests/REST_API/Status_Check_Controller.php index 0f43f37ebc66..59f8de7dbbcc 100644 --- a/tests/phpunit/integration/tests/REST_API/Status_Check_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Status_Check_Controller.php @@ -17,6 +17,7 @@ namespace Google\Web_Stories\Tests\Integration\REST_API; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Story_Post_Type; use WP_REST_Request; @@ -62,8 +63,9 @@ public static function wpSetUpBeforeClass( $factory ) { public function set_up() { parent::set_up(); + $settings = new Settings(); $this->controller = new \Google\Web_Stories\REST_API\Status_Check_Controller( - new Story_Post_Type( new Settings() ) + new Story_Post_Type( $settings, new Experiments( $settings ) ) ); } diff --git a/tests/phpunit/integration/tests/REST_API/Stories_Autosaves_Controller.php b/tests/phpunit/integration/tests/REST_API/Stories_Autosaves_Controller.php index be7c08f9337e..45e70a52948c 100644 --- a/tests/phpunit/integration/tests/REST_API/Stories_Autosaves_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Stories_Autosaves_Controller.php @@ -17,6 +17,7 @@ namespace Google\Web_Stories\Tests\Integration\REST_API; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Story_Post_Type; use Google\Web_Stories\Tests\Integration\Test_REST_TestCase; @@ -56,8 +57,9 @@ public static function wpSetUpBeforeClass( $factory ) { public function set_up() { parent::set_up(); + $settings = new Settings(); $this->controller = new \Google\Web_Stories\REST_API\Stories_Autosaves_Controller( - new Story_Post_Type( new Settings() ) + new Story_Post_Type( $settings, new Experiments( $settings ) ) ); } diff --git a/tests/phpunit/integration/tests/REST_API/Stories_Lock_Controller.php b/tests/phpunit/integration/tests/REST_API/Stories_Lock_Controller.php index f1a0b26e4724..69a5948d68d0 100644 --- a/tests/phpunit/integration/tests/REST_API/Stories_Lock_Controller.php +++ b/tests/phpunit/integration/tests/REST_API/Stories_Lock_Controller.php @@ -17,6 +17,7 @@ namespace Google\Web_Stories\Tests\Integration\REST_API; +use Google\Web_Stories\Experiments; use Google\Web_Stories\Settings; use Google\Web_Stories\Story_Post_Type; use Google\Web_Stories\Tests\Integration\Test_REST_TestCase; @@ -65,8 +66,9 @@ public static function wpSetUpBeforeClass( $factory ) { public function set_up() { parent::set_up(); + $settings = new Settings(); $this->controller = new \Google\Web_Stories\REST_API\Stories_Lock_Controller( - new Story_Post_Type( new Settings() ) + new Story_Post_Type( $settings, new Experiments( $settings ) ) ); }