Skip to content

Commit

Permalink
set default value for mobile cache to be 1
Browse files Browse the repository at this point in the history
  • Loading branch information
wordpressfan committed Jul 1, 2024
1 parent cb820e9 commit b42cc6b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 20 deletions.
7 changes: 1 addition & 6 deletions inc/Engine/Media/AboveTheFold/WarmUp/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,25 @@ protected function setUp(): void {
*/
public function testShouldReturnExpected( $config, $expected ) {
$this->options->shouldReceive('get')
->with('cache_mobile', 0)
->andReturn(0);
->with( 'cache_mobile', 1 )
->andReturn( 1 );

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( 1 );

$this->api_client->shouldReceive('add_to_atf_queue')
->with('http://example.com')
->once()
->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']);
Expand Down

0 comments on commit b42cc6b

Please sign in to comment.