diff options
Diffstat (limited to 'tests/integration/controller.php')
-rw-r--r-- | tests/integration/controller.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/integration/controller.php b/tests/integration/controller.php index ec3297f..549244a 100644 --- a/tests/integration/controller.php +++ b/tests/integration/controller.php @@ -80,11 +80,39 @@ class Controller extends \OCP\AppFramework\Controller { * * @return \OC_OCS_Result */ + public function addNotification() { + if (!$this->config->getAppValue('notifications', 'debug')) { + return new \OC_OCS_Result(null, Http::STATUS_FORBIDDEN); + } + + $notification = $this->manager->createNotification(); + $notification->setApp('testing') + ->setDateTime(\DateTime::createFromFormat('U', 1449585176)) // 2015-12-08T14:32:56+00:00 + ->setUser('test1') + ->setSubject('testing') + ->setLink('https://www.owncloud.org/') + ->setMessage('message') + ->setObject('object', 23); + + $this->manager->notify($notification); + + return new \OC_OCS_Result(); + } + + /** + * @NoCSRFRequired + * + * @return \OC_OCS_Result + */ public function reset() { if (!$this->config->getAppValue('notifications', 'debug')) { return new \OC_OCS_Result(null, Http::STATUS_FORBIDDEN); } + $notification = $this->manager->createNotification(); + $notification->setApp('testing'); + $this->manager->markProcessed($notification); + $this->config->deleteAppValue('notifications', 'forceHasNotifiers'); return new \OC_OCS_Result(); } |