Add capabilities
This commit is contained in:
Родитель
2143a47e27
Коммит
96edd1061b
|
@ -36,6 +36,7 @@ use OCA\Activity\ParameterHelper;
|
|||
use OCA\Activity\UserSettings;
|
||||
use OCA\AnnouncementCenter\Controller\PageController;
|
||||
use OCA\AnnouncementCenter\Manager;
|
||||
use OCA\Notifications\Capabilities;
|
||||
use OCA\Notifications\Controller\EndPointController;
|
||||
use OCA\Notifications\Handler;
|
||||
use OCP\AppFramework\App;
|
||||
|
@ -64,6 +65,12 @@ class Application extends App {
|
|||
$this->getCurrentUser($server->getUserSession())
|
||||
);
|
||||
});
|
||||
|
||||
$container->registerService('Capabilities', function(IContainer $c) {
|
||||
return new Capabilities();
|
||||
});
|
||||
|
||||
$container->registerCapability('Capabilities');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Joas Schilling <nickvergessen@owncloud.com>
|
||||
*
|
||||
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Notifications;
|
||||
|
||||
use OCP\Capabilities\ICapability;
|
||||
|
||||
/**
|
||||
* Class Capabilities
|
||||
*
|
||||
* @package OCA\Notifications
|
||||
*/
|
||||
class Capabilities implements ICapability {
|
||||
|
||||
/**
|
||||
* Return this classes capabilities
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getCapabilities() {
|
||||
return [
|
||||
'notifications' => [
|
||||
'endpoints' => [
|
||||
'get',
|
||||
'delete',
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Notifications\Tests;
|
||||
namespace OCA\Notifications\Tests\AppInfo;
|
||||
|
||||
use OCA\Notifications\Tests\TestCase;
|
||||
|
||||
|
|
|
@ -19,9 +19,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Notifications\Tests;
|
||||
namespace OCA\Notifications\Tests\AppInfo;
|
||||
|
||||
use OCA\Notifications\AppInfo\Application;
|
||||
use OCA\Notifications\Tests\TestCase;
|
||||
|
||||
class ApplicationTest extends TestCase {
|
||||
/** @var \OCA\Notifications\AppInfo\Application */
|
||||
|
@ -44,6 +45,7 @@ class ApplicationTest extends TestCase {
|
|||
public function dataContainerQuery() {
|
||||
return array(
|
||||
array('EndpointController', 'OCA\Notifications\Controller\EndpointController'),
|
||||
array('Capabilities', 'OCA\Notifications\Capabilities'),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Notifications\Tests;
|
||||
namespace OCA\Notifications\Tests\AppInfo;
|
||||
|
||||
use OCA\Notifications\Tests\TestCase;
|
||||
|
||||
class RoutesTest extends TestCase {
|
||||
public function testRoutes() {
|
||||
|
|
|
@ -25,6 +25,9 @@ if (!defined('PHPUNIT_RUN')) {
|
|||
|
||||
require_once __DIR__.'/../../../lib/base.php';
|
||||
|
||||
// Temp fix for the "Path not allowed: .../tests/lib/testcase.php"
|
||||
\OC::$loader->addValidRoot(OC::$SERVERROOT . '/tests');
|
||||
|
||||
if(!class_exists('PHPUnit_Framework_TestCase')) {
|
||||
require_once('PHPUnit/Autoload.php');
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @author Joas Schilling <nickvergessen@owncloud.com>
|
||||
*
|
||||
* @copyright Copyright (c) 2015, ownCloud, Inc.
|
||||
* @license AGPL-3.0
|
||||
*
|
||||
* This code is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License, version 3,
|
||||
* as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License, version 3,
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*
|
||||
*/
|
||||
|
||||
namespace OCA\Notifications\Tests\Lib;
|
||||
|
||||
use OCA\Notifications\Capabilities;
|
||||
use OCA\Notifications\Tests\TestCase;
|
||||
|
||||
class CapabilitiesTest extends TestCase {
|
||||
|
||||
public function testGetCapabilities() {
|
||||
$capabilities = new Capabilities();
|
||||
|
||||
$this->assertSame([
|
||||
'notifications' => [
|
||||
'endpoints' => [
|
||||
'get',
|
||||
'delete',
|
||||
],
|
||||
],
|
||||
], $capabilities->getCapabilities());
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче