Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
remyperona committed Nov 11, 2024
1 parent a30995a commit b5b5728
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
36 changes: 30 additions & 6 deletions tests/Fixtures/src/Admin/Notices/Notices/updateNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
'api_key' => '123456',
'previous_version' => '1.0.5',
'user_meta' => false,
'cdn_url' => 'https://cdn.example.org',
'previous_cdn_url' => 'https://cdn.example.org',
'cdn_url' => 'https://xxxx.delivery.rocketcdn.me',
'previous_cdn_url' => 'https://xxxx.rocketcdn.me',
],
'expected' => '',
],
Expand All @@ -20,8 +20,8 @@
'api_key' => '123456',
'previous_version' => '1.0.5',
'user_meta' => false,
'cdn_url' => 'https://cdn.example.org',
'previous_cdn_url' => 'https://cdn.example.org',
'cdn_url' => 'https://xxxx.delivery.rocketcdn.me',
'previous_cdn_url' => 'https://xxxx.rocketcdn.me',
],
'expected' => '',
],
Expand All @@ -32,8 +32,32 @@
'api_key' => '',
'previous_version' => '1.0.5',
'user_meta' => false,
'cdn_url' => 'https://cdn.example.org',
'previous_cdn_url' => 'https://cdn.example.org',
'cdn_url' => 'https://xxxx.delivery.rocketcdn.me',
'previous_cdn_url' => 'https://xxxx.rocketcdn.me',
],
'expected' => '',
],
'testShouldDoNothingWhenNoCdnUrl' => [
'config' => [
'current_user_can' => true,
'current_screen_id' => 'settings_page_rocketcdn',
'api_key' => '123456',
'previous_version' => '1.0.5',
'user_meta' => false,
'cdn_url' => 'https://xxxx.delivery.rocketcdn.me',
'previous_cdn_url' => 'https://xxxx.rocketcdn.me',
],
'expected' => '',
],
'testShouldDoNothingWhenNoPreviousCdnUrl' => [
'config' => [
'current_user_can' => true,
'current_screen_id' => 'settings_page_rocketcdn',
'api_key' => '123456',
'previous_version' => '1.0.5',
'user_meta' => false,
'cdn_url' => 'https://xxxx.delivery.rocketcdn.me',
'previous_cdn_url' => '',
],
'expected' => '',
],
Expand Down
8 changes: 8 additions & 0 deletions tests/Unit/src/Admin/Notices/Notices/updateNotice.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ public function testShouldReturnExpected( $config, $expected ) {
->with( 'api_key', '' )
->andReturn( $config['api_key'] );

$this->options->shouldReceive( 'get' )
->with( 'cdn_url', '' )
->andReturn( $config['cdn_url'] );

$this->options->shouldReceive( 'get' )
->with( 'previous_cdn_url', '' )
->andReturn( $config['previous_cdn_url'] );

$this->options->shouldReceive( 'get' )
->with( 'previous_version', '' )
->andReturn( $config['previous_version'] );
Expand Down

0 comments on commit b5b5728

Please sign in to comment.