summaryrefslogtreecommitdiffstats
path: root/apps/updatenotification
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2017-11-24 10:41:51 +0100
committerMorris Jobke <hey@morrisjobke.de>2017-11-25 12:01:02 +0100
commitdf61d43529418aace241b99be106ff9a35188dac (patch)
tree1dee18bbed4828e67b96f87c41f3a43f799fd822 /apps/updatenotification
parent0e2f00ec59424b2ef5708a928856e2c75abe6deb (diff)
downloadnextcloud-server-df61d43529418aace241b99be106ff9a35188dac.tar.gz
nextcloud-server-df61d43529418aace241b99be106ff9a35188dac.zip
Make isUpdateAvailable non-static
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/updatenotification')
-rw-r--r--apps/updatenotification/lib/Notification/BackgroundJob.php9
-rw-r--r--apps/updatenotification/tests/Notification/BackgroundJobTest.php8
2 files changed, 14 insertions, 3 deletions
diff --git a/apps/updatenotification/lib/Notification/BackgroundJob.php b/apps/updatenotification/lib/Notification/BackgroundJob.php
index 08baa35664f..3c0cac60cde 100644
--- a/apps/updatenotification/lib/Notification/BackgroundJob.php
+++ b/apps/updatenotification/lib/Notification/BackgroundJob.php
@@ -53,6 +53,9 @@ class BackgroundJob extends TimedJob {
/** @var IClientService */
protected $client;
+ /** @var Installer */
+ protected $installer;
+
/** @var string[] */
protected $users;
@@ -64,8 +67,9 @@ class BackgroundJob extends TimedJob {
* @param IGroupManager $groupManager
* @param IAppManager $appManager
* @param IClientService $client
+ * @param Installer $installer
*/
- public function __construct(IConfig $config, IManager $notificationManager, IGroupManager $groupManager, IAppManager $appManager, IClientService $client) {
+ public function __construct(IConfig $config, IManager $notificationManager, IGroupManager $groupManager, IAppManager $appManager, IClientService $client, Installer $installer) {
// Run once a day
$this->setInterval(60 * 60 * 24);
@@ -74,6 +78,7 @@ class BackgroundJob extends TimedJob {
$this->groupManager = $groupManager;
$this->appManager = $appManager;
$this->client = $client;
+ $this->installer = $installer;
}
protected function run($argument) {
@@ -257,6 +262,6 @@ class BackgroundJob extends TimedJob {
* @return string|false
*/
protected function isUpdateAvailable($app) {
- return Installer::isUpdateAvailable($app, \OC::$server->getAppFetcher());
+ return $this->installer->isUpdateAvailable($app);
}
}
diff --git a/apps/updatenotification/tests/Notification/BackgroundJobTest.php b/apps/updatenotification/tests/Notification/BackgroundJobTest.php
index 92a8a687f5a..0355b10a09c 100644
--- a/apps/updatenotification/tests/Notification/BackgroundJobTest.php
+++ b/apps/updatenotification/tests/Notification/BackgroundJobTest.php
@@ -23,6 +23,7 @@
namespace OCA\UpdateNotification\Tests\Notification;
+use OC\Installer;
use OCA\UpdateNotification\Notification\BackgroundJob;
use OCP\App\IAppManager;
use OCP\Http\Client\IClientService;
@@ -47,6 +48,8 @@ class BackgroundJobTest extends TestCase {
protected $appManager;
/** @var IClientService|\PHPUnit_Framework_MockObject_MockObject */
protected $client;
+ /** @var Installer|\PHPUnit_Framework_MockObject_MockObject */
+ protected $installer;
public function setUp() {
parent::setUp();
@@ -56,6 +59,7 @@ class BackgroundJobTest extends TestCase {
$this->groupManager = $this->createMock(IGroupManager::class);
$this->appManager = $this->createMock(IAppManager::class);
$this->client = $this->createMock(IClientService::class);
+ $this->installer = $this->createMock(Installer::class);
}
/**
@@ -69,7 +73,8 @@ class BackgroundJobTest extends TestCase {
$this->notificationManager,
$this->groupManager,
$this->appManager,
- $this->client
+ $this->client,
+ $this->installer
);
} {
return $this->getMockBuilder(BackgroundJob::class)
@@ -79,6 +84,7 @@ class BackgroundJobTest extends TestCase {
$this->groupManager,
$this->appManager,
$this->client,
+ $this->installer,
])
->setMethods($methods)
->getMock();