diff --git a/tests/Fixtures/inc/Engine/License/API/User/isLicenseExpiredGracePeriod.php b/tests/Fixtures/inc/Engine/License/API/User/isLicenseExpiredGracePeriod.php new file mode 100644 index 0000000000..cfef602422 --- /dev/null +++ b/tests/Fixtures/inc/Engine/License/API/User/isLicenseExpiredGracePeriod.php @@ -0,0 +1,28 @@ + [ + 'data' => [], + 'expected' => true, + ], + 'testShouldReturnTrueWhenPropertyNotSet' => [ + 'data' => json_decode( json_encode( [ + 'ID' => 1, + ] ) ), + 'expected' => true, + ], + 'testShouldReturnFalseWhenNotExpired' => [ + 'data' => json_decode( json_encode( [ + 'ID' => 1, + 'licence_expiration' => strtotime( 'next week' ), + ] ) ), + 'expected' => false, + ], + 'testShouldReturnTrueWhenExpired' => [ + 'data' => json_decode( json_encode( [ + 'ID' => 1, + 'licence_expiration' => strtotime( '3 weeks ago' ), + ] ) ), + 'expected' => true, + ], +]; diff --git a/tests/Integration/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php b/tests/Integration/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php deleted file mode 100644 index 80b73a9373..0000000000 --- a/tests/Integration/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php +++ /dev/null @@ -1,41 +0,0 @@ -set_permalink_structure( "/%postname%/" ); - - $this->unregisterAllCallbacksExcept( 'rocket_preload_exclude_urls', 'exclude_private_post_uri', 10 ); - } - - public function tear_down() { - $this->restoreWpHook( 'rocket_preload_exclude_urls' ); - - parent::tear_down(); - } - - /** - * @dataProvider configTestData - */ - public function testShouldDoAsExpected( $config, $expected ) { - if ( $config['have_posts'] ) { - $this->factory->post->create( [ - 'post_title' => 'test 4', - 'post_status' => 'private', - 'post_type' => 'post' - ] ); - } - - $this->assertSame( $expected, apply_filters( 'rocket_preload_exclude_urls', $config['regex'], $config['url'] ) ); - } -} diff --git a/tests/Unit/inc/Engine/Common/JobManager/Strategy/Context/RetryContext/setStrategy.php b/tests/Unit/inc/Engine/Common/JobManager/Strategy/Context/RetryContext/setStrategy.php deleted file mode 100644 index 2448260738..0000000000 --- a/tests/Unit/inc/Engine/Common/JobManager/Strategy/Context/RetryContext/setStrategy.php +++ /dev/null @@ -1,27 +0,0 @@ -query = $this->createPartialMock(Cache::class, ['get_rows_by_url', 'query']); + + $this->query = $this->createPartialMock( Cache::class, [ 'get_rows_by_url', 'query' ] ); } /** * @dataProvider configTestData */ - public function testShouldReturnAsExpected($config, $expected) { - $this->query->expects($this->at(0))->method('query')->with( [ - 'status' => 'in-progress', - 'is_locked' => false, - 'date_query' => [ - [ - 'column' => 'modified', - 'before' => '3 minute ago', + public function testShouldReturnAsExpected( $config, $expected ) { + $this->query->method( 'query' )->with( + [ + 'status' => 'in-progress', + 'is_locked' => false, + 'date_query' => [ + [ + 'column' => 'modified', + 'before' => '3 minute ago', + ], ], - ], - ] )->willReturn( $config['results'] ); - + ] + )->willReturn( $config['results'] ); - $this->assertSame($expected, $this->query->get_outdated_in_progress_jobs()); + $this->assertSame( + $expected, + $this->query->get_outdated_in_progress_jobs() + ); } } diff --git a/tests/Unit/inc/Engine/Preload/Database/Queries/Cache/makeStatusComplete.php b/tests/Unit/inc/Engine/Preload/Database/Queries/Cache/makeStatusComplete.php index ef2142097a..0084a6b221 100644 --- a/tests/Unit/inc/Engine/Preload/Database/Queries/Cache/makeStatusComplete.php +++ b/tests/Unit/inc/Engine/Preload/Database/Queries/Cache/makeStatusComplete.php @@ -8,7 +8,6 @@ /** * Test class covering \WP_Rocket\Engine\Preload\Database\Queries\Cache::make_status_complete - * @uses \WP_Rocket\Engine\Preload\Database\Queries\CacheRow * * @group Database * @group Preload diff --git a/tests/Unit/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php b/tests/Unit/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php deleted file mode 100644 index b1531f9e38..0000000000 --- a/tests/Unit/inc/Engine/Preload/Subscriber/excludePrivatePostUri.php +++ /dev/null @@ -1,75 +0,0 @@ -options = Mockery::mock(Options_Data::class); - $this->controller = Mockery::mock(LoadInitialSitemap::class); - $this->query = $this->createMock(Cache::class); - $this->activation = Mockery::mock(Activation::class); - $this->mobile_detect = Mockery::mock(WP_Rocket_Mobile_Detect::class); - $this->clear_cache = Mockery::mock(ClearCache::class); - $this->queue = Mockery::mock(Queue::class); - $this->subscriber = new Subscriber($this->options, $this->controller, $this->query, $this->activation, $this->mobile_detect, $this->clear_cache, $this->queue ); - } - - /** - * @dataProvider configTestData - */ - public function testShouldDoAsExpected( $config, $expected) { - WP_Query::$have_posts = $config['have_posts']; - WP_Query::$set_posts = $config['posts']; - - Functions\expect( 'get_post_types' ) - ->once() - ->andReturn( $config['post_types'] ); - - if ( ! $config['have_posts'] ) { - Functions\expect( 'get_permalink' )->never(); - } else { - Functions\expect( 'get_permalink' ) - ->once() - ->andReturnValues( $config['get_permalink'] ); - } - - $this->assertSame( $expected, $this->subscriber->exclude_private_post_uri( $config['regex'], $config['url'] ) ); - } -} diff --git a/tests/Unit/inc/ThirdParty/Themes/Divi/addDiviToDescription.php b/tests/Unit/inc/ThirdParty/Themes/Divi/addDiviToDescription.php index 666365c908..23f73a9aeb 100644 --- a/tests/Unit/inc/ThirdParty/Themes/Divi/addDiviToDescription.php +++ b/tests/Unit/inc/ThirdParty/Themes/Divi/addDiviToDescription.php @@ -10,7 +10,6 @@ /** * Test class covering \WP_Rocket\ThirdParty\Themes\Divi::add_divi_to_description - * @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi * * @group ThirdParty */ diff --git a/tests/Unit/inc/ThirdParty/Themes/Divi/disableDiviJqueryBody.php b/tests/Unit/inc/ThirdParty/Themes/Divi/disableDiviJqueryBody.php index ccdf6f2e08..ee8d0c1fe8 100644 --- a/tests/Unit/inc/ThirdParty/Themes/Divi/disableDiviJqueryBody.php +++ b/tests/Unit/inc/ThirdParty/Themes/Divi/disableDiviJqueryBody.php @@ -7,11 +7,9 @@ use Brain\Monkey\Functions; use WP_Rocket\ThirdParty\Themes\Divi; use WP_Theme; -use Brain\Monkey\Filters; /** * Test class covering \WP_Rocket\ThirdParty\Themes\Divi::disable_divi_jquery_body - * @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi * * @group ThirdParty */ diff --git a/tests/Unit/inc/ThirdParty/Themes/Divi/disableImageDimensionsHeightPercentage.php b/tests/Unit/inc/ThirdParty/Themes/Divi/disableImageDimensionsHeightPercentage.php index 6321da9150..67efc86a10 100644 --- a/tests/Unit/inc/ThirdParty/Themes/Divi/disableImageDimensionsHeightPercentage.php +++ b/tests/Unit/inc/ThirdParty/Themes/Divi/disableImageDimensionsHeightPercentage.php @@ -13,7 +13,6 @@ /** * Test class covering \WP_Rocket\ThirdParty\Themes\Divi::disable_image_dimensions_height_percentage - * @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi * * @group ThirdParty */ diff --git a/tests/Unit/inc/ThirdParty/Themes/Divi/removeAssetsGenerated.php b/tests/Unit/inc/ThirdParty/Themes/Divi/removeAssetsGenerated.php index e891f92c7f..8efee6b4c5 100644 --- a/tests/Unit/inc/ThirdParty/Themes/Divi/removeAssetsGenerated.php +++ b/tests/Unit/inc/ThirdParty/Themes/Divi/removeAssetsGenerated.php @@ -14,7 +14,6 @@ /** * Test class covering \WP_Rocket\ThirdParty\Themes\Divi::remove_assets_generated - * @uses \WP_Rocket\ThirdParty\Themes\Divi::is_divi * * @group ThirdParty */ diff --git a/tests/Unit/inc/common/rocketGetPurgeUrls.php b/tests/Unit/inc/common/rocketGetPurgeUrls.php index 117a18b231..64e4b6fdce 100644 --- a/tests/Unit/inc/common/rocketGetPurgeUrls.php +++ b/tests/Unit/inc/common/rocketGetPurgeUrls.php @@ -42,7 +42,6 @@ public function setUp() : void { * @dataProvider providerTestData */ public function testShouldReturnUrls( $config, $expected ) { - $this->markTestSkipped('Error with require'); $post_id = isset( $config['post_data']['ID'] ) ? $config['post_data']['ID'] : 0; $post = isset( $config['post_data'] ) ? (object) $config['post_data'] : null; $options = isset( $config['options'] ) ? $config['options'] : [];