Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leonidasmi committed Oct 2, 2024
1 parent d421ba2 commit 9e9c3ae
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 38 deletions.
37 changes: 9 additions & 28 deletions tests/Unit/Integrations/Front_End_Integration_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
use WPSEO_Replace_Vars;
use Yoast\WP\SEO\Conditionals\Front_End_Conditional;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Helpers\Request_Helper;
use Yoast\WP\SEO\Integrations\Front_End_Integration;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
use Yoast\WP\SEO\Presentations\Indexable_Presentation;
Expand Down Expand Up @@ -48,13 +47,6 @@ final class Front_End_Integration_Test extends TestCase {
*/
private $options;

/**
* Represents the request helper.
*
* @var Mockery\MockInterface|Request_Helper
*/
private $request;

/**
* Represents the meta tags context memoizer.
*
Expand Down Expand Up @@ -94,15 +86,13 @@ protected function set_up() {
$this->context_memoizer = Mockery::mock( Meta_Tags_Context_Memoizer::class );
$this->container = Mockery::mock( ContainerInterface::class );
$this->options = Mockery::mock( Options_Helper::class );
$this->request = Mockery::mock( Request_Helper::class );

$this->instance = Mockery::mock(
Front_End_Integration::class,
[
$this->context_memoizer,
$this->container,
$this->options,
$this->request,
Mockery::mock( Helpers_Surface::class ),
Mockery::mock( WPSEO_Replace_Vars::class ),
]
Expand Down Expand Up @@ -219,8 +209,7 @@ public function test_get_presenters_for_singular_page() {
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -287,8 +276,7 @@ public function test_get_presenters_for_static_home_page() {
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -360,8 +348,7 @@ public function test_get_presenters_for_error_page() {
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -419,8 +406,7 @@ public function test_get_presenters_for_non_singular_page() {
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -486,8 +472,7 @@ public function test_get_presenters_for_theme_without_title_tag_and_force_rewrit
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -533,8 +518,7 @@ public function test_get_presenters_for_theme_on_rest_request() {
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnTrue();

Expand Down Expand Up @@ -588,8 +572,7 @@ public function test_get_presenters_for_theme_without_title_tag_and_force_rewrit
->once()
->andReturn( $this->context );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -662,8 +645,7 @@ public function test_filter_robots_presenter_and_wp_robots_to_wp_head_filter() {

\add_action( 'wp_head', 'wp_robots' );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnFalse();

Expand Down Expand Up @@ -694,8 +676,7 @@ public function test_rest_request_should_output_robots_presenter() {

\add_action( 'wp_head', 'wp_robots' );

$this->request
->expects( 'is_rest_request' )
Monkey\Functions\expect( 'wp_is_serving_rest_request' )
->once()
->andReturnTrue();

Expand Down
10 changes: 0 additions & 10 deletions tests/WP/Frontend/Front_End_Integration_Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
use Mockery;
use WPSEO_Replace_Vars;
use Yoast\WP\SEO\Helpers\Options_Helper;
use Yoast\WP\SEO\Helpers\Request_Helper;
use Yoast\WP\SEO\Memoizers\Meta_Tags_Context_Memoizer;
use Yoast\WP\SEO\Presentations\Indexable_Presentation;
use Yoast\WP\SEO\Surfaces\Helpers_Surface;
Expand Down Expand Up @@ -41,13 +40,6 @@ final class Front_End_Integration_Test extends TestCase {
*/
protected $options;

/**
* Represents the request helper.
*
* @var Request_Helper
*/
protected $request;

/**
* The helpers surface.
*
Expand Down Expand Up @@ -79,15 +71,13 @@ public function set_up(): void {
$this->context_memoizer = Mockery::mock( Meta_Tags_Context_Memoizer::class );
$this->container = Mockery::mock( ContainerInterface::class );
$this->options = Mockery::mock( Options_Helper::class );
$this->request = Mockery::mock( Request_Helper::class );
$this->helpers = Mockery::mock( Helpers_Surface::class );
$this->replace_vars = Mockery::mock( WPSEO_Replace_Vars::class );

$this->instance = new Front_End_Integration_Double(
$this->context_memoizer,
$this->container,
$this->options,
$this->request,
$this->helpers,
$this->replace_vars
);
Expand Down

0 comments on commit 9e9c3ae

Please sign in to comment.