From a050e179fbfa69ffca705eb85a82099a14c8f5d9 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sat, 12 Mar 2022 17:22:22 +0100 Subject: [PATCH] Main_Test: set expectations in the test itself, not in the `set_up()` fixture method --- tests/unit/main-test.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/unit/main-test.php b/tests/unit/main-test.php index 485db22587e..e462d963fec 100644 --- a/tests/unit/main-test.php +++ b/tests/unit/main-test.php @@ -54,12 +54,6 @@ protected function set_up() { global $wpdb; $wpdb = Mockery::mock( '\wpdb' ); - - // Some classes call the YoastSEO function in the constructor. - Monkey\Functions\expect( 'YoastSEO' ) - ->andReturn( $this->instance ); - // Deprecated classes call _deprecated_function in the constructor. - Monkey\Functions\expect( '_deprecated_function' ); } /** @@ -68,6 +62,13 @@ protected function set_up() { * @covers ::get_container */ public function test_surfaces() { + + // Some classes call the YoastSEO function in the constructor. + Monkey\Functions\expect( 'YoastSEO' ) + ->andReturn( $this->instance ); + // Deprecated classes call _deprecated_function in the constructor. + Monkey\Functions\expect( '_deprecated_function' ); + $container = $this->instance->get_container(); foreach ( $container->getServiceIds() as $service_id ) {