Skip to content

Commit

Permalink
test(updatenotification): No internet
Browse files Browse the repository at this point in the history
Signed-off-by: Christopher Ng <[email protected]>
(cherry picked from commit de4bc44)
  • Loading branch information
Pytal committed Aug 11, 2023
1 parent da565d7 commit 7c7edbb
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions apps/updatenotification/tests/Notification/BackgroundJobTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,34 @@ public function testRun() {
$job->expects($this->once())
->method('checkAppUpdates');

$this->config->expects($this->exactly(2))
->method('getSystemValueBool')
->withConsecutive(
['has_internet_connection', true],
['debug', false],
)
->willReturnOnConsecutiveCalls(
true,
true,
);

self::invokePrivate($job, 'run', [null]);
}

public function testRunNoInternet() {
$job = $this->getJob([
'checkCoreUpdate',
'checkAppUpdates',
]);

$job->expects($this->never())
->method('checkCoreUpdate');
$job->expects($this->never())
->method('checkAppUpdates');

$this->config->method('getSystemValueBool')
->with('debug', false)
->willReturn(true);
->with('has_internet_connection', true)
->willReturn(false);

self::invokePrivate($job, 'run', [null]);
}
Expand Down

0 comments on commit 7c7edbb

Please sign in to comment.