diff --git a/inc/Engine/Media/AboveTheFold/WarmUp/Controller.php b/inc/Engine/Media/AboveTheFold/WarmUp/Controller.php index 86750d4239..004ebe1cb1 100644 --- a/inc/Engine/Media/AboveTheFold/WarmUp/Controller.php +++ b/inc/Engine/Media/AboveTheFold/WarmUp/Controller.php @@ -240,11 +240,6 @@ public function add_wpr_imagedimensions_query_arg( string $url ): string { * @return bool */ private function is_mobile(): bool { - $plugin_version = (string) get_rocket_option( 'version', '' ); - if ( ! $plugin_version ) { // We are warming up a fresh installation. Options are not set yet. - return true; - } - - return $this->options->get( 'cache_mobile', 0 ) && $this->options->get( 'do_caching_mobile_files', 0 ); + return $this->options->get( 'cache_mobile', 1 ) && $this->options->get( 'do_caching_mobile_files', 1 ); } } diff --git a/tests/Unit/inc/Engine/Media/AboveTheFold/WarmUp/Controller/sendToSass.php b/tests/Unit/inc/Engine/Media/AboveTheFold/WarmUp/Controller/sendToSass.php index 3d84363cbf..5f4bbfdd02 100644 --- a/tests/Unit/inc/Engine/Media/AboveTheFold/WarmUp/Controller/sendToSass.php +++ b/tests/Unit/inc/Engine/Media/AboveTheFold/WarmUp/Controller/sendToSass.php @@ -36,16 +36,15 @@ protected function setUp(): void { * @dataProvider configTestData */ public function testShouldReturnExpected( $config, $expected ) { + $mobile_cache = 'mobile' === $config['device'] ? 1 : 0; + $this->options->shouldReceive('get') - ->with('cache_mobile', 0) - ->andReturn(0); + ->with( 'cache_mobile', 1 ) + ->andReturn( $mobile_cache ); - if('desktop' === $config['device']) { - Functions\expect( 'get_rocket_option' ) - ->once() - ->with( 'version', '' ) - ->andReturn( true ); - } + $this->options->shouldReceive('get') + ->with( 'do_caching_mobile_files', 1 ) + ->andReturn( $mobile_cache ); $this->api_client->shouldReceive('add_to_atf_queue') ->with('http://example.com') @@ -53,15 +52,10 @@ public function testShouldReturnExpected( $config, $expected ) { ->andReturn([$config['url'], []]); if('mobile' === $config['device']) { - Functions\expect( 'get_rocket_option' ) - ->once() - ->with( 'version', '' ) - ->andReturn( '' ); - $this->api_client->shouldReceive('add_to_atf_queue') - ->with('http://example.com', $config['device']) + ->with( 'http://example.com', $config['device'] ) ->once() - ->andReturn([$config['url'], []]); + ->andReturn( [$config['url'], []] ); } $this->controller->send_to_saas($config['url']);