aboutsummaryrefslogtreecommitdiffstats
path: root/apps/provisioning_api
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2016-10-27 17:41:15 +0200
committerLukas Reschke <lukas@statuscode.ch>2016-10-31 17:17:44 +0100
commit32cf661215fb3926789054a3953b465fc2665330 (patch)
tree4cf2865bef5856c59a1fdacb98208a14dfc1a128 /apps/provisioning_api
parent357a823457397d3e93ec8cd4dc01fb6859eb0049 (diff)
downloadnextcloud-server-32cf661215fb3926789054a3953b465fc2665330.tar.gz
nextcloud-server-32cf661215fb3926789054a3953b465fc2665330.zip
Use new appstore API
This change introduces the new appstore API in Nextcloud. Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'apps/provisioning_api')
-rw-r--r--apps/provisioning_api/lib/Controller/AppsController.php9
-rw-r--r--apps/provisioning_api/tests/Controller/AppsControllerTest.php20
2 files changed, 5 insertions, 24 deletions
diff --git a/apps/provisioning_api/lib/Controller/AppsController.php b/apps/provisioning_api/lib/Controller/AppsController.php
index 3821fc343ad..7d11d92b55a 100644
--- a/apps/provisioning_api/lib/Controller/AppsController.php
+++ b/apps/provisioning_api/lib/Controller/AppsController.php
@@ -37,25 +37,20 @@ use OCP\IRequest;
class AppsController extends OCSController {
/** @var \OCP\App\IAppManager */
private $appManager;
- /** @var OCSClient */
- private $ocsClient;
/**
* @param string $appName
* @param IRequest $request
* @param IAppManager $appManager
- * @param OCSClient $ocsClient
*/
public function __construct(
$appName,
IRequest $request,
- IAppManager $appManager,
- OCSClient $ocsClient
+ IAppManager $appManager
) {
parent::__construct($appName, $request);
$this->appManager = $appManager;
- $this->ocsClient = $ocsClient;
}
/**
@@ -64,7 +59,7 @@ class AppsController extends OCSController {
* @throws OCSException
*/
public function getApps($filter = null) {
- $apps = OC_App::listAllApps(false, true, $this->ocsClient);
+ $apps = (new OC_App())->listAllApps();
$list = [];
foreach($apps as $app) {
$list[] = $app['id'];
diff --git a/apps/provisioning_api/tests/Controller/AppsControllerTest.php b/apps/provisioning_api/tests/Controller/AppsControllerTest.php
index 9ac4a8290e4..c891433258f 100644
--- a/apps/provisioning_api/tests/Controller/AppsControllerTest.php
+++ b/apps/provisioning_api/tests/Controller/AppsControllerTest.php
@@ -48,8 +48,6 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
private $api;
/** @var IUserSession */
private $userSession;
- /** @var OCSClient|\PHPUnit_Framework_MockObject_MockObject */
- private $ocsClient;
protected function setUp() {
parent::setUp();
@@ -57,9 +55,6 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$this->appManager = \OC::$server->getAppManager();
$this->groupManager = \OC::$server->getGroupManager();
$this->userSession = \OC::$server->getUserSession();
- $this->ocsClient = $this->getMockBuilder('OC\OCSClient')
- ->disableOriginalConstructor()
- ->getMock();
$request = $this->getMockBuilder('OCP\IRequest')
->disableOriginalConstructor()
@@ -68,8 +63,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$this->api = new AppsController(
'provisioning_api',
$request,
- $this->appManager,
- $this->ocsClient
+ $this->appManager
);
}
@@ -88,10 +82,6 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
}
public function testGetApps() {
- $this->ocsClient
- ->expects($this->any())
- ->method($this->anything())
- ->will($this->returnValue(null));
$user = $this->generateUsers();
$this->groupManager->get('admin')->addUser($user);
$this->userSession->setUser($user);
@@ -99,7 +89,7 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
$result = $this->api->getApps();
$data = $result->getData();
- $this->assertEquals(count(\OC_App::listAllApps(false, true, $this->ocsClient)), count($data['apps']));
+ $this->assertEquals(count((new \OC_App())->listAllApps()), count($data['apps']));
}
public function testGetAppsEnabled() {
@@ -109,13 +99,9 @@ class AppsControllerTest extends \OCA\Provisioning_API\Tests\TestCase {
}
public function testGetAppsDisabled() {
- $this->ocsClient
- ->expects($this->any())
- ->method($this->anything())
- ->will($this->returnValue(null));
$result = $this->api->getApps('disabled');
$data = $result->getData();
- $apps = \OC_App::listAllApps(false, true, $this->ocsClient);
+ $apps = (new \OC_App)->listAllApps();
$list = array();
foreach($apps as $app) {
$list[] = $app['id'];