Skip to content

Commit e751de2

Browse files
committed
removed not needed reference and recovered previous version of unit test
1 parent 41823db commit e751de2

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

includes/HealthChecks/PersistentObjectCacheHealthCheck.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace NewfoldLabs\WP\Module\Performance\HealthChecks;
44

5-
use function NewfoldLabs\WP\Module\LinkTracker\Functions\build_link as buildLink;
65
/**
76
* Health check for persistent object cache.
87
*/

tests/phpunit/includes/HealthChecksTest.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace NewfoldLabs\WP\Module\Performance\HealthChecks;
44

5-
use Mockery;
65
use WP_Mock;
76
use WP_Mock\Tools\TestCase;
87
use Patchwork;
@@ -329,15 +328,18 @@ public function test_defer_non_essential_js_health_check() {
329328
* Test PersistentObjectCacheHealthCheck.
330329
*/
331330
public function test_persistent_object_cache_health_check() {
331+
WP_Mock::userFunction( 'wp_using_ext_object_cache' )
332+
->once()
333+
->andReturn( true );
332334

333-
$mock = Mockery::mock( 'PersistentObjectCacheHealthCheck' );
334-
335-
$mock->shouldReceive( 'test' )->once()->andReturn( true );
336-
$this->assertTrue( $mock->test(), 'Persistent object caching should pass when enabled.' );
335+
$health_check = new PersistentObjectCacheHealthCheck();
336+
$this->assertTrue( $health_check->test(), 'Persistent object caching should pass when enabled.' );
337337

338-
$mock->shouldReceive( 'test' )->once()->andReturn( false );
338+
WP_Mock::userFunction( 'wp_using_ext_object_cache' )
339+
->once()
340+
->andReturn( false );
339341

340-
$this->assertFalse( $mock->test(), 'Persistent object caching should fail when not enabled.' );
342+
$this->assertFalse( $health_check->test(), 'Persistent object caching should fail when not enabled.' );
341343
}
342344

343345
/**

0 commit comments

Comments
 (0)