Skip to content

Commit

Permalink
Merge pull request #18191 from Yoast/JRF/QA/main-test-minor-fix
Browse files Browse the repository at this point in the history
Main_Test: set expectations in the test itself, not in the `set_up()` fixture method
  • Loading branch information
jrfnl committed Mar 12, 2022
2 parents 253a3bf + a050e17 commit e191e75
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions tests/unit/main-test.php
Expand Up @@ -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' );
}

/**
Expand All @@ -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 ) {
Expand Down

0 comments on commit e191e75

Please sign in to comment.