Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make sure to send mobile visit to saas warmup for OCI with a fresh install #6753

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -36,32 +36,26 @@ 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')
->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
Loading