Move OCS Provider to PSR-4 namespace

This commit is contained in:
Joas Schilling 2016-05-19 11:09:38 +02:00
parent 7ca5b35379
commit 20f229eed9
No known key found for this signature in database
GPG Key ID: 70A0B324C41C0946
4 changed files with 14 additions and 9 deletions

View File

@ -19,6 +19,8 @@
* *
*/ */
namespace OC\OCS;
class Provider extends \OCP\AppFramework\Controller { class Provider extends \OCP\AppFramework\Controller {
/** @var \OCP\App\IAppManager */ /** @var \OCP\App\IAppManager */
private $appManager; private $appManager;

View File

@ -20,13 +20,12 @@
*/ */
require_once('../lib/base.php'); require_once('../lib/base.php');
require_once(__DIR__ . '/provider.php');
header('Content-Type: application/json'); header('Content-Type: application/json');
$server = \OC::$server; $server = \OC::$server;
$controller = new Provider( $controller = new \OC\OCS\Provider(
'ocs_provider', 'ocs_provider',
$server->getRequest(), $server->getRequest(),
$server->getAppManager() $server->getAppManager()

View File

@ -1,6 +1,4 @@
<?php <?php
use OCP\AppFramework\Http;
/** /**
* @author Thomas Müller <thomas.mueller@tmit.eu> * @author Thomas Müller <thomas.mueller@tmit.eu>
* *
@ -21,13 +19,17 @@ use OCP\AppFramework\Http;
* *
*/ */
class OcsResponseTest extends \Test\TestCase { namespace Test\OCS;
use OCP\AppFramework\Http;
class MapStatusCodeTest extends \Test\TestCase {
/** /**
* @dataProvider providesStatusCodes * @dataProvider providesStatusCodes
*/ */
public function testStatusCodeMapper($expected, $sc) { public function testStatusCodeMapper($expected, $sc) {
$result = OC_API::mapStatusCodes($sc); $result = \OC_API::mapStatusCodes($sc);
$this->assertEquals($expected, $result); $this->assertEquals($expected, $result);
} }

View File

@ -19,7 +19,11 @@
* *
*/ */
class OcsProviderTest extends \Test\TestCase { namespace Test\OCS;
use OC\OCS\Provider;
class ProviderTest extends \Test\TestCase {
/** @var \OCP\IRequest */ /** @var \OCP\IRequest */
private $request; private $request;
/** @var \OCP\App\IAppManager */ /** @var \OCP\App\IAppManager */
@ -30,8 +34,6 @@ class OcsProviderTest extends \Test\TestCase {
public function setUp() { public function setUp() {
parent::setUp(); parent::setUp();
require_once '../ocs-provider/provider.php';
$this->request = $this->getMockBuilder('\\OCP\\IRequest')->getMock(); $this->request = $this->getMockBuilder('\\OCP\\IRequest')->getMock();
$this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager')->getMock(); $this->appManager = $this->getMockBuilder('\\OCP\\App\\IAppManager')->getMock();
$this->ocsProvider = new Provider('ocs_provider', $this->request, $this->appManager); $this->ocsProvider = new Provider('ocs_provider', $this->request, $this->appManager);