Skip to content

Commit de4bc44

Browse files
committed
test(updatenotification): No internet
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent b63dbae commit de4bc44

1 file changed

Lines changed: 27 additions & 2 deletions

File tree

apps/updatenotification/tests/Notification/BackgroundJobTest.php

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,34 @@ public function testRun() {
112112
$job->expects($this->once())
113113
->method('checkAppUpdates');
114114

115+
$this->config->expects($this->exactly(2))
116+
->method('getSystemValueBool')
117+
->withConsecutive(
118+
['has_internet_connection', true],
119+
['debug', false],
120+
)
121+
->willReturnOnConsecutiveCalls(
122+
true,
123+
true,
124+
);
125+
126+
self::invokePrivate($job, 'run', [null]);
127+
}
128+
129+
public function testRunNoInternet() {
130+
$job = $this->getJob([
131+
'checkCoreUpdate',
132+
'checkAppUpdates',
133+
]);
134+
135+
$job->expects($this->never())
136+
->method('checkCoreUpdate');
137+
$job->expects($this->never())
138+
->method('checkAppUpdates');
139+
115140
$this->config->method('getSystemValueBool')
116-
->with('debug', false)
117-
->willReturn(true);
141+
->with('has_internet_connection', true)
142+
->willReturn(false);
118143

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

0 commit comments

Comments
 (0)