diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-22 16:20:26 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2016-01-22 16:20:26 +0100 |
commit | 7731b2913691db6966dac77241ed93b45902f7e3 (patch) | |
tree | 9f3abb4c0f2f30fb607833fae57f504fe20cc860 | |
parent | 21131d133a949c4a574430f15c8e605eeb296ade (diff) | |
parent | 31c5848e51e8a61e0f6c9931efa15ff80681e0e1 (diff) | |
download | nextcloud-server-7731b2913691db6966dac77241ed93b45902f7e3.tar.gz nextcloud-server-7731b2913691db6966dac77241ed93b45902f7e3.zip |
Merge pull request #21719 from owncloud/move-notification-api-to-ocp
Move the notification API to public namespace
17 files changed, 143 insertions, 149 deletions
diff --git a/apps/files_sharing/lib/external/manager.php b/apps/files_sharing/lib/external/manager.php index 7112aa63d17..ea49348737f 100644 --- a/apps/files_sharing/lib/external/manager.php +++ b/apps/files_sharing/lib/external/manager.php @@ -28,7 +28,7 @@ namespace OCA\Files_Sharing\External; use OC\Files\Filesystem; use OCP\Files; -use OC\Notification\IManager; +use OCP\Notification\IManager; class Manager { const STORAGE = '\OCA\Files_Sharing\External\Storage'; diff --git a/apps/files_sharing/lib/notifier.php b/apps/files_sharing/lib/notifier.php index c5c56151458..802f22e44c5 100644 --- a/apps/files_sharing/lib/notifier.php +++ b/apps/files_sharing/lib/notifier.php @@ -22,8 +22,8 @@ namespace OCA\Files_Sharing; -use OC\Notification\INotification; -use OC\Notification\INotifier; +use OCP\Notification\INotification; +use OCP\Notification\INotifier; class Notifier implements INotifier { /** @var \OCP\L10N\IFactory */ diff --git a/lib/private/appframework/dependencyinjection/dicontainer.php b/lib/private/appframework/dependencyinjection/dicontainer.php index a9614262603..175d6c747e4 100644 --- a/lib/private/appframework/dependencyinjection/dicontainer.php +++ b/lib/private/appframework/dependencyinjection/dicontainer.php @@ -174,6 +174,10 @@ class DIContainer extends SimpleContainer implements IAppContainer { return $this->getServer()->getNavigationManager(); }); + $this->registerService('OCP\\Notification\IManager', function($c) { + return $this->getServer()->getNotificationManager(); + }); + $this->registerService('OCP\\IPreview', function($c) { return $this->getServer()->getPreviewManager(); }); diff --git a/lib/private/notification/action.php b/lib/private/notification/action.php index 1730756c1de..deac6807653 100644 --- a/lib/private/notification/action.php +++ b/lib/private/notification/action.php @@ -22,6 +22,8 @@ namespace OC\Notification; +use OCP\Notification\IAction; + class Action implements IAction { /** @var string */ diff --git a/lib/private/notification/manager.php b/lib/private/notification/manager.php index 239b5bfe5c7..a14a1deec0c 100644 --- a/lib/private/notification/manager.php +++ b/lib/private/notification/manager.php @@ -22,6 +22,11 @@ namespace OC\Notification; +use OCP\Notification\IApp; +use OCP\Notification\IManager; +use OCP\Notification\INotification; +use OCP\Notification\INotifier; + class Manager implements IManager { /** @var IApp */ protected $apps; diff --git a/lib/private/notification/notification.php b/lib/private/notification/notification.php index 677658eb3e8..6568f53f255 100644 --- a/lib/private/notification/notification.php +++ b/lib/private/notification/notification.php @@ -22,6 +22,9 @@ namespace OC\Notification; +use OCP\Notification\IAction; +use OCP\Notification\INotification; + class Notification implements INotification { /** @var string */ protected $app; diff --git a/lib/private/server.php b/lib/private/server.php index 2497c056600..6e9c5ca0c68 100644 --- a/lib/private/server.php +++ b/lib/private/server.php @@ -1176,7 +1176,7 @@ class Server extends ServerContainer implements IServerContainer { /** * Get the Notification Manager * - * @return \OC\Notification\IManager + * @return \OCP\Notification\IManager * @since 8.2.0 */ public function getNotificationManager() { diff --git a/lib/public/iservercontainer.php b/lib/public/iservercontainer.php index 82084f021e8..e21c9fb8e4b 100644 --- a/lib/public/iservercontainer.php +++ b/lib/public/iservercontainer.php @@ -476,8 +476,8 @@ interface IServerContainer { /** * Get the Notification Manager * - * @return \OC\Notification\IManager - * @since 8.2.0 + * @return \OCP\Notification\IManager + * @since 9.0.0 */ public function getNotificationManager(); diff --git a/lib/private/notification/iaction.php b/lib/public/notification/iaction.php index 79e28ecef89..1f4d1d5b7fe 100644 --- a/lib/private/notification/iaction.php +++ b/lib/public/notification/iaction.php @@ -19,30 +19,26 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface IAction * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface IAction { /** * @param string $label * @return $this * @throws \InvalidArgumentException if the label is invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setLabel($label); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getLabel(); @@ -50,13 +46,13 @@ interface IAction { * @param string $label * @return $this * @throws \InvalidArgumentException if the label is invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setParsedLabel($label); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedLabel(); @@ -79,31 +75,31 @@ interface IAction { * @param string $requestType * @return $this * @throws \InvalidArgumentException if the link is invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setLink($link, $requestType); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getLink(); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getRequestType(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValid(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValidParsed(); } diff --git a/lib/private/notification/iapp.php b/lib/public/notification/iapp.php index 8ae4f6a5437..98da265559b 100644 --- a/lib/private/notification/iapp.php +++ b/lib/public/notification/iapp.php @@ -19,38 +19,34 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface IApp * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface IApp { /** * @param INotification $notification * @return null * @throws \InvalidArgumentException When the notification is not valid - * @since 8.2.0 + * @since 9.0.0 */ public function notify(INotification $notification); /** * @param INotification $notification * @return null - * @since 8.2.0 + * @since 9.0.0 */ public function markProcessed(INotification $notification); /** * @param INotification $notification * @return int - * @since 8.2.0 + * @since 9.0.0 */ public function getCount(INotification $notification); } diff --git a/lib/private/notification/imanager.php b/lib/public/notification/imanager.php index 2f8e3ba39fc..a18af747b10 100644 --- a/lib/private/notification/imanager.php +++ b/lib/public/notification/imanager.php @@ -19,24 +19,20 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface IManager * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface IManager extends IApp, INotifier { /** * @param \Closure $service The service must implement IApp, otherwise a * \InvalidArgumentException is thrown later * @return null - * @since 8.2.0 + * @since 9.0.0 */ public function registerApp(\Closure $service); @@ -46,7 +42,7 @@ interface IManager extends IApp, INotifier { * @param \Closure $info An array with the keys 'id' and 'name' containing * the app id and the app name * @return null - * @since 8.2.0 - Parameter $info was added in 9.0.0 + * @since 9.0.0 */ public function registerNotifier(\Closure $service, \Closure $info); @@ -58,13 +54,13 @@ interface IManager extends IApp, INotifier { /** * @return INotification - * @since 8.2.0 + * @since 9.0.0 */ public function createNotification(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function hasNotifiers(); } diff --git a/lib/private/notification/inotification.php b/lib/public/notification/inotification.php index 921f0779b92..2d8557ec64d 100644 --- a/lib/private/notification/inotification.php +++ b/lib/public/notification/inotification.php @@ -19,30 +19,26 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface INotification * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface INotification { /** * @param string $app * @return $this * @throws \InvalidArgumentException if the app id are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setApp($app); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getApp(); @@ -50,13 +46,13 @@ interface INotification { * @param string $user * @return $this * @throws \InvalidArgumentException if the user id are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setUser($user); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getUser(); @@ -79,19 +75,19 @@ interface INotification { * @param string $id * @return $this * @throws \InvalidArgumentException if the object type or id is invalid - * @since 8.2.0 - 9.0.0: Type of $id changed to string + * @since 9.0.0 */ public function setObject($type, $id); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getObjectType(); /** * @return string - * @since 8.2.0 - 9.0.0: Return type changed to string + * @since 9.0.0 */ public function getObjectId(); @@ -100,19 +96,19 @@ interface INotification { * @param array $parameters * @return $this * @throws \InvalidArgumentException if the subject or parameters are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setSubject($subject, array $parameters = []); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getSubject(); /** * @return string[] - * @since 8.2.0 + * @since 9.0.0 */ public function getSubjectParameters(); @@ -120,13 +116,13 @@ interface INotification { * @param string $subject * @return $this * @throws \InvalidArgumentException if the subject are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setParsedSubject($subject); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedSubject(); @@ -135,19 +131,19 @@ interface INotification { * @param array $parameters * @return $this * @throws \InvalidArgumentException if the message or parameters are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setMessage($message, array $parameters = []); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getMessage(); /** * @return string[] - * @since 8.2.0 + * @since 9.0.0 */ public function getMessageParameters(); @@ -155,13 +151,13 @@ interface INotification { * @param string $message * @return $this * @throws \InvalidArgumentException if the message are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setParsedMessage($message); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedMessage(); @@ -169,19 +165,19 @@ interface INotification { * @param string $link * @return $this * @throws \InvalidArgumentException if the link are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function setLink($link); /** * @return string - * @since 8.2.0 + * @since 9.0.0 */ public function getLink(); /** * @return IAction - * @since 8.2.0 + * @since 9.0.0 */ public function createAction(); @@ -189,13 +185,13 @@ interface INotification { * @param IAction $action * @return $this * @throws \InvalidArgumentException if the action are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function addAction(IAction $action); /** * @return IAction[] - * @since 8.2.0 + * @since 9.0.0 */ public function getActions(); @@ -203,25 +199,25 @@ interface INotification { * @param IAction $action * @return $this * @throws \InvalidArgumentException if the action are invalid - * @since 8.2.0 + * @since 9.0.0 */ public function addParsedAction(IAction $action); /** * @return IAction[] - * @since 8.2.0 + * @since 9.0.0 */ public function getParsedActions(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValid(); /** * @return bool - * @since 8.2.0 + * @since 9.0.0 */ public function isValidParsed(); } diff --git a/lib/private/notification/inotifier.php b/lib/public/notification/inotifier.php index c4312308fc0..0d9cecc88b8 100644 --- a/lib/private/notification/inotifier.php +++ b/lib/public/notification/inotifier.php @@ -19,17 +19,13 @@ * */ -namespace OC\Notification; +namespace OCP\Notification; /** * Interface INotifier * - * @package OC\Notification - * @since 8.2.0 - * - * DEVELOPER NOTE: - * The notification api is experimental only in 8.2.0! Do not start using it, - * if you can not prepare an update for the next version afterwards. + * @package OCP\Notification + * @since 9.0.0 */ interface INotifier { /** @@ -37,7 +33,7 @@ interface INotifier { * @param string $languageCode The code of the language that should be used to prepare the notification * @return INotification * @throws \InvalidArgumentException When the notification was not prepared by a notifier - * @since 8.2.0 + * @since 9.0.0 */ public function prepare(INotification $notification, $languageCode); } diff --git a/tests/lib/notification/actiontest.php b/tests/lib/notification/actiontest.php index 0044df82cd1..74c995280c9 100644 --- a/tests/lib/notification/actiontest.php +++ b/tests/lib/notification/actiontest.php @@ -23,7 +23,7 @@ namespace Test\Notification; use OC\Notification\Action; -use OC\Notification\IAction; +use OCP\Notification\IAction; use Test\TestCase; class ActionTest extends TestCase { diff --git a/tests/lib/notification/managertest.php b/tests/lib/notification/managertest.php index 1f411bc74ee..4410781bc31 100644 --- a/tests/lib/notification/managertest.php +++ b/tests/lib/notification/managertest.php @@ -22,7 +22,7 @@ namespace Test\Notification; use OC\Notification\Manager; -use OC\Notification\IManager; +use OCP\Notification\IManager; use Test\TestCase; class ManagerTest extends TestCase { @@ -35,7 +35,7 @@ class ManagerTest extends TestCase { } public function testRegisterApp() { - $app = $this->getMockBuilder('OC\Notification\IApp') + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); @@ -59,7 +59,7 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testRegisterAppInvalid() { - $notifier = $this->getMockBuilder('OC\Notification\INotifier') + $notifier = $this->getMockBuilder('OCP\Notification\INotifier') ->disableOriginalConstructor() ->getMock(); @@ -73,7 +73,7 @@ class ManagerTest extends TestCase { } public function testRegisterNotifier() { - $notifier = $this->getMockBuilder('OC\Notification\INotifier') + $notifier = $this->getMockBuilder('OCP\Notification\INotifier') ->disableOriginalConstructor() ->getMock(); @@ -105,7 +105,7 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testRegisterNotifierInvalid() { - $app = $this->getMockBuilder('OC\Notification\IApp') + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); @@ -136,7 +136,7 @@ class ManagerTest extends TestCase { * @param mixed $data */ public function testRegisterNotifierInfoInvalid($data) { - $app = $this->getMockBuilder('OC\Notification\IApp') + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); @@ -156,7 +156,7 @@ class ManagerTest extends TestCase { * @expectedExceptionMessage The given notifier ID test1 is already in use */ public function testRegisterNotifierInfoDuplicate() { - $app = $this->getMockBuilder('OC\Notification\IApp') + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); @@ -177,28 +177,28 @@ class ManagerTest extends TestCase { public function testCreateNotification() { $action = $this->manager->createNotification(); - $this->assertInstanceOf('OC\Notification\INotification', $action); + $this->assertInstanceOf('OCP\Notification\INotification', $action); } public function testNotify() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) ->method('isValid') ->willReturn(true); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ - $app = $this->getMockBuilder('OC\Notification\IApp') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); $app->expects($this->once()) ->method('notify') ->with($notification); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ - $app2 = $this->getMockBuilder('OC\Notification\IApp') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ + $app2 = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); $app2->expects($this->once()) @@ -219,8 +219,8 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testNotifyInvalid() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -231,23 +231,23 @@ class ManagerTest extends TestCase { } public function testPrepare() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) ->method('isValidParsed') ->willReturn(true); - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification2 */ - $notification2 = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification2 */ + $notification2 = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification2->expects($this->exactly(2)) ->method('isValidParsed') ->willReturn(true); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ - $notifier = $this->getMockBuilder('OC\Notification\INotifier') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ + $notifier = $this->getMockBuilder('OCP\Notification\INotifier') ->disableOriginalConstructor() ->getMock(); $notifier->expects($this->once()) @@ -255,8 +255,8 @@ class ManagerTest extends TestCase { ->with($notification, 'en') ->willReturnArgument(0); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier2 */ - $notifier2 = $this->getMockBuilder('OC\Notification\INotifier') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier2 */ + $notifier2 = $this->getMockBuilder('OCP\Notification\INotifier') ->disableOriginalConstructor() ->getMock(); $notifier2->expects($this->once()) @@ -282,16 +282,16 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testPrepareInvalid() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) ->method('isValidParsed') ->willReturn(false); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ - $notifier = $this->getMockBuilder('OC\Notification\INotifier') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ + $notifier = $this->getMockBuilder('OCP\Notification\INotifier') ->disableOriginalConstructor() ->getMock(); $notifier->expects($this->once()) @@ -309,16 +309,16 @@ class ManagerTest extends TestCase { } public function testPrepareNotifierThrows() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) ->method('isValidParsed') ->willReturn(true); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ - $notifier = $this->getMockBuilder('OC\Notification\INotifier') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $notifier */ + $notifier = $this->getMockBuilder('OCP\Notification\INotifier') ->disableOriginalConstructor() ->getMock(); $notifier->expects($this->once()) @@ -339,8 +339,8 @@ class ManagerTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testPrepareNoNotifier() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); $notification->expects($this->once()) @@ -351,21 +351,21 @@ class ManagerTest extends TestCase { } public function testMarkProcessed() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ - $app = $this->getMockBuilder('OC\Notification\IApp') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); $app->expects($this->once()) ->method('markProcessed') ->with($notification); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ - $app2 = $this->getMockBuilder('OC\Notification\IApp') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ + $app2 = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); $app2->expects($this->once()) @@ -383,13 +383,13 @@ class ManagerTest extends TestCase { } public function testGetCount() { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ - $notification = $this->getMockBuilder('OC\Notification\INotification') + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + $notification = $this->getMockBuilder('OCP\Notification\INotification') ->disableOriginalConstructor() ->getMock(); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ - $app = $this->getMockBuilder('OC\Notification\IApp') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app */ + $app = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); $app->expects($this->once()) @@ -397,8 +397,8 @@ class ManagerTest extends TestCase { ->with($notification) ->willReturn(21); - /** @var \OC\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ - $app2 = $this->getMockBuilder('OC\Notification\IApp') + /** @var \OCP\Notification\IApp|\PHPUnit_Framework_MockObject_MockObject $app2 */ + $app2 = $this->getMockBuilder('OCP\Notification\IApp') ->disableOriginalConstructor() ->getMock(); $app2->expects($this->once()) diff --git a/tests/lib/notification/notificationtest.php b/tests/lib/notification/notificationtest.php index 91fa1de8b42..ee9454c77a0 100644 --- a/tests/lib/notification/notificationtest.php +++ b/tests/lib/notification/notificationtest.php @@ -23,7 +23,7 @@ namespace Test\Notification; use OC\Notification\Notification; -use OC\Notification\INotification; +use OCP\Notification\INotification; use Test\TestCase; class NotificationTest extends TestCase { @@ -388,12 +388,12 @@ class NotificationTest extends TestCase { public function testCreateAction() { $action = $this->notification->createAction(); - $this->assertInstanceOf('OC\Notification\IAction', $action); + $this->assertInstanceOf('OCP\Notification\IAction', $action); } public function testAddAction() { - /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ - $action = $this->getMockBuilder('OC\Notification\IAction') + /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ + $action = $this->getMockBuilder('OCP\Notification\IAction') ->disableOriginalConstructor() ->getMock(); $action->expects($this->once()) @@ -412,8 +412,8 @@ class NotificationTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testAddActionInvalid() { - /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ - $action = $this->getMockBuilder('OC\Notification\IAction') + /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ + $action = $this->getMockBuilder('OCP\Notification\IAction') ->disableOriginalConstructor() ->getMock(); $action->expects($this->once()) @@ -426,8 +426,8 @@ class NotificationTest extends TestCase { } public function testAddActionSecondPrimary() { - /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ - $action = $this->getMockBuilder('OC\Notification\IAction') + /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ + $action = $this->getMockBuilder('OCP\Notification\IAction') ->disableOriginalConstructor() ->getMock(); $action->expects($this->exactly(2)) @@ -444,8 +444,8 @@ class NotificationTest extends TestCase { } public function testAddParsedAction() { - /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ - $action = $this->getMockBuilder('OC\Notification\IAction') + /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ + $action = $this->getMockBuilder('OCP\Notification\IAction') ->disableOriginalConstructor() ->getMock(); $action->expects($this->once()) @@ -464,8 +464,8 @@ class NotificationTest extends TestCase { * @expectedException \InvalidArgumentException */ public function testAddParsedActionInvalid() { - /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ - $action = $this->getMockBuilder('OC\Notification\IAction') + /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ + $action = $this->getMockBuilder('OCP\Notification\IAction') ->disableOriginalConstructor() ->getMock(); $action->expects($this->once()) @@ -478,8 +478,8 @@ class NotificationTest extends TestCase { } public function testAddActionSecondParsedPrimary() { - /** @var \OC\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ - $action = $this->getMockBuilder('OC\Notification\IAction') + /** @var \OCP\Notification\IAction|\PHPUnit_Framework_MockObject_MockObject $action */ + $action = $this->getMockBuilder('OCP\Notification\IAction') ->disableOriginalConstructor() ->getMock(); $action->expects($this->exactly(2)) @@ -512,7 +512,7 @@ class NotificationTest extends TestCase { * @param bool $expected */ public function testIsValid($isValidCommon, $subject, $expected) { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ $notification = $this->getMockBuilder('\OC\Notification\Notification') ->setMethods([ 'isValidCommon', @@ -543,7 +543,7 @@ class NotificationTest extends TestCase { * @param bool $expected */ public function testIsParsedValid($isValidCommon, $subject, $expected) { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ $notification = $this->getMockBuilder('\OC\Notification\Notification') ->setMethods([ 'isValidCommon', @@ -588,7 +588,7 @@ class NotificationTest extends TestCase { * @param bool $expected */ public function testIsValidCommon($app, $user, $timestamp, $objectType, $objectId, $expected) { - /** @var \OC\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ + /** @var \OCP\Notification\INotification|\PHPUnit_Framework_MockObject_MockObject $notification */ $notification = $this->getMockBuilder('\OC\Notification\Notification') ->setMethods([ 'getApp', diff --git a/tests/lib/server.php b/tests/lib/server.php index 684e6a97361..91beea7c2f8 100644 --- a/tests/lib/server.php +++ b/tests/lib/server.php @@ -116,7 +116,7 @@ class Server extends \Test\TestCase { ['NavigationManager', '\OC\NavigationManager'], ['NavigationManager', '\OCP\INavigationManager'], ['NotificationManager', '\OC\Notification\Manager'], - ['NotificationManager', '\OC\Notification\IManager'], + ['NotificationManager', '\OCP\Notification\IManager'], ['UserCache', '\OC\Cache\File'], ['UserCache', '\OCP\ICache'], |