diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-05 17:12:37 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-09-05 17:12:37 +0300 |
commit | f3c7a02db6175e981adbe39d0b592d9bab4eb2fc (patch) | |
tree | 61ade4f86fd4f18bc211cda25a08072183a81e34 /tests/Integration | |
parent | b489c001a7f7561c71bbc3f438bad15ecdc9b43e (diff) |
Update the testing app as well
Diffstat (limited to 'tests/Integration')
-rw-r--r-- | tests/Integration/app/appinfo/app.php | 6 | ||||
-rw-r--r-- | tests/Integration/app/appinfo/info.xml | 1 | ||||
-rw-r--r-- | tests/Integration/app/appinfo/routes.php | 23 | ||||
-rw-r--r-- | tests/Integration/app/lib/Controller/EndpointController.php (renamed from tests/Integration/app/controller.php) | 16 | ||||
-rw-r--r-- | tests/Integration/app/lib/Notifier.php (renamed from tests/Integration/app/notifier.php) | 0 |
5 files changed, 16 insertions, 30 deletions
diff --git a/tests/Integration/app/appinfo/app.php b/tests/Integration/app/appinfo/app.php index b483403..61dae99 100644 --- a/tests/Integration/app/appinfo/app.php +++ b/tests/Integration/app/appinfo/app.php @@ -19,12 +19,8 @@ * */ -namespace OCA\NotificationsIntegrationTesting\AppInfo; - -use OCA\NotificationsIntegrationTesting\Notifier; - \OC::$server->getNotificationManager()->registerNotifier(function() { - return new Notifier(); + return new \OCA\NotificationsIntegrationTesting\Notifier(); }, function() { return [ 'id' => 'testing', diff --git a/tests/Integration/app/appinfo/info.xml b/tests/Integration/app/appinfo/info.xml index c21ef11..04ef870 100644 --- a/tests/Integration/app/appinfo/info.xml +++ b/tests/Integration/app/appinfo/info.xml @@ -2,6 +2,7 @@ <info> <id>notificationsintegrationtesting</id> <name>Notifications Integration Testing</name> + <namespace>NotificationsIntegrationTesting</namespace> <description/> <licence>AGPL</licence> diff --git a/tests/Integration/app/appinfo/routes.php b/tests/Integration/app/appinfo/routes.php index ff5bb45..d53872c 100644 --- a/tests/Integration/app/appinfo/routes.php +++ b/tests/Integration/app/appinfo/routes.php @@ -19,20 +19,9 @@ * */ -$controller = new \OCA\NotificationsIntegrationTesting\Controller( - 'notificationsintegrationtesting', - \OC::$server->getRequest(), - \OC::$server->getNotificationManager() -); -\OCP\API::register( - 'delete', - '/apps/notificationsintegrationtesting', - [$controller, 'deleteNotifications'], - 'notificationsintegrationtesting' -); -\OCP\API::register( - 'post', - '/apps/notificationsintegrationtesting/notifications', - [$controller, 'addNotification'], - 'notificationsintegrationtesting' -); +return [ + 'ocs' => [ + ['name' => 'Endpoint#deleteNotifications', 'url' => '', 'verb' => 'DELETE'], + ['name' => 'Endpoint#addNotification', 'url' => '/notifications', 'verb' => 'POST'], + ], +]; diff --git a/tests/Integration/app/controller.php b/tests/Integration/app/lib/Controller/EndpointController.php index 96abd5a..11a6cfa 100644 --- a/tests/Integration/app/controller.php +++ b/tests/Integration/app/lib/Controller/EndpointController.php @@ -19,13 +19,14 @@ * */ -namespace OCA\NotificationsIntegrationTesting; +namespace OCA\NotificationsIntegrationTesting\Controller; -use OCP\AppFramework\Http; +use OCP\AppFramework\OCSController; +use OCP\AppFramework\Http\DataResponse; use OCP\IRequest; use OCP\Notification\IManager; -class Controller extends \OCP\AppFramework\Controller { +class EndpointController extends OCSController { /** @var IManager */ private $manager; @@ -37,14 +38,13 @@ class Controller extends \OCP\AppFramework\Controller { */ public function __construct($appName, IRequest $request, IManager $manager) { parent::__construct($appName, $request); - $this->manager = $manager; } /** * @NoCSRFRequired * - * @return \OC_OCS_Result + * @return DataResponse */ public function addNotification() { $notification = $this->manager->createNotification(); @@ -58,18 +58,18 @@ class Controller extends \OCP\AppFramework\Controller { $this->manager->notify($notification); - return new \OC_OCS_Result(); + return new DataResponse(); } /** * @NoCSRFRequired * - * @return \OC_OCS_Result + * @return DataResponse */ public function deleteNotifications() { $notification = $this->manager->createNotification(); $this->manager->markProcessed($notification); - return new \OC_OCS_Result(); + return new DataResponse(); } } diff --git a/tests/Integration/app/notifier.php b/tests/Integration/app/lib/Notifier.php index e5ed324..e5ed324 100644 --- a/tests/Integration/app/notifier.php +++ b/tests/Integration/app/lib/Notifier.php |