summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 17:36:55 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 17:36:55 -0400
commitd6c1c1ea33de6386fabe7c9546bfae1c38d3b9e7 (patch)
treeee4f0a0d830c7019061204a1d659ff00ce6c29f5
parent88ee691bb9c17bd6d2b93873ed789d2edc120b37 (diff)
Improve notification classes and move interface to core
-rw-r--r--app/Controller/UserCreationController.php2
-rw-r--r--app/Core/Notification/NotificationInterface.php (renamed from app/Notification/NotificationInterface.php)4
-rw-r--r--app/Notification/ActivityStreamNotification.php (renamed from app/Notification/ActivityStream.php)5
-rw-r--r--app/Notification/MailNotification.php (renamed from app/Notification/Mail.php)5
-rw-r--r--app/Notification/WebNotification.php (renamed from app/Notification/Web.php)5
-rw-r--r--app/Notification/WebhookNotification.php (renamed from app/Notification/Webhook.php)5
-rw-r--r--app/ServiceProvider/NotificationProvider.php12
-rw-r--r--tests/units/Notification/MailTest.php8
8 files changed, 25 insertions, 21 deletions
diff --git a/app/Controller/UserCreationController.php b/app/Controller/UserCreationController.php
index 49f9db54..4ae170e0 100644
--- a/app/Controller/UserCreationController.php
+++ b/app/Controller/UserCreationController.php
@@ -3,7 +3,7 @@
namespace Kanboard\Controller;
use Kanboard\Core\Security\Role;
-use Kanboard\Notification\Mail as MailNotification;
+use Kanboard\Notification\MailNotification;
/**
* Class UserCreationController
diff --git a/app/Notification/NotificationInterface.php b/app/Core/Notification/NotificationInterface.php
index 8431a77c..d336983a 100644
--- a/app/Notification/NotificationInterface.php
+++ b/app/Core/Notification/NotificationInterface.php
@@ -1,11 +1,11 @@
<?php
-namespace Kanboard\Notification;
+namespace Kanboard\Core\Notification;
/**
* Notification Interface
*
- * @package core
+ * @package Kanboard\Core\Notification
* @author Frederic Guillot
*/
interface NotificationInterface
diff --git a/app/Notification/ActivityStream.php b/app/Notification/ActivityStreamNotification.php
index 325732ec..8ac265d3 100644
--- a/app/Notification/ActivityStream.php
+++ b/app/Notification/ActivityStreamNotification.php
@@ -3,14 +3,15 @@
namespace Kanboard\Notification;
use Kanboard\Core\Base;
+use Kanboard\Core\Notification\NotificationInterface;
/**
* Activity Stream Notification
*
- * @package notification
+ * @package Kanboard\Notification
* @author Frederic Guillot
*/
-class ActivityStream extends Base implements NotificationInterface
+class ActivityStreamNotification extends Base implements NotificationInterface
{
/**
* Send notification to a user
diff --git a/app/Notification/Mail.php b/app/Notification/MailNotification.php
index c924fb50..0ba06715 100644
--- a/app/Notification/Mail.php
+++ b/app/Notification/MailNotification.php
@@ -3,6 +3,7 @@
namespace Kanboard\Notification;
use Kanboard\Core\Base;
+use Kanboard\Core\Notification\NotificationInterface;
use Kanboard\Model\Task;
use Kanboard\Model\TaskFile;
use Kanboard\Model\Comment;
@@ -11,10 +12,10 @@ use Kanboard\Model\Subtask;
/**
* Email Notification
*
- * @package notification
+ * @package Kanboard\Notification
* @author Frederic Guillot
*/
-class Mail extends Base implements NotificationInterface
+class MailNotification extends Base implements NotificationInterface
{
/**
* Notification type
diff --git a/app/Notification/Web.php b/app/Notification/WebNotification.php
index 9271c193..99c0c903 100644
--- a/app/Notification/Web.php
+++ b/app/Notification/WebNotification.php
@@ -3,14 +3,15 @@
namespace Kanboard\Notification;
use Kanboard\Core\Base;
+use Kanboard\Core\Notification\NotificationInterface;
/**
* Web Notification
*
- * @package notification
+ * @package Kanboard\Notification
* @author Frederic Guillot
*/
-class Web extends Base implements NotificationInterface
+class WebNotification extends Base implements NotificationInterface
{
/**
* Notification type
diff --git a/app/Notification/Webhook.php b/app/Notification/WebhookNotification.php
index e187909f..25d59251 100644
--- a/app/Notification/Webhook.php
+++ b/app/Notification/WebhookNotification.php
@@ -3,14 +3,15 @@
namespace Kanboard\Notification;
use Kanboard\Core\Base;
+use Kanboard\Core\Notification\NotificationInterface;
/**
* Webhook Notification
*
- * @package notification
+ * @package Kanboard\Notification
* @author Frederic Guillot
*/
-class Webhook extends Base implements NotificationInterface
+class WebhookNotification extends Base implements NotificationInterface
{
/**
* Send notification to a user
diff --git a/app/ServiceProvider/NotificationProvider.php b/app/ServiceProvider/NotificationProvider.php
index 23d1d516..2cb01576 100644
--- a/app/ServiceProvider/NotificationProvider.php
+++ b/app/ServiceProvider/NotificationProvider.php
@@ -6,8 +6,8 @@ use Pimple\Container;
use Pimple\ServiceProviderInterface;
use Kanboard\Model\UserNotificationType;
use Kanboard\Model\ProjectNotificationType;
-use Kanboard\Notification\Mail as MailNotification;
-use Kanboard\Notification\Web as WebNotification;
+use Kanboard\Notification\MailNotification as MailNotification;
+use Kanboard\Notification\WebNotification as WebNotification;
/**
* Notification Provider
@@ -28,15 +28,15 @@ class NotificationProvider implements ServiceProviderInterface
{
$container['userNotificationType'] = function ($container) {
$type = new UserNotificationType($container);
- $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\Mail');
- $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\Web');
+ $type->setType(MailNotification::TYPE, t('Email'), '\Kanboard\Notification\MailNotification');
+ $type->setType(WebNotification::TYPE, t('Web'), '\Kanboard\Notification\WebNotification');
return $type;
};
$container['projectNotificationType'] = function ($container) {
$type = new ProjectNotificationType($container);
- $type->setType('webhook', 'Webhook', '\Kanboard\Notification\Webhook', true);
- $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStream', true);
+ $type->setType('webhook', 'Webhook', '\Kanboard\Notification\WebhookNotification', true);
+ $type->setType('activity_stream', 'ActivityStream', '\Kanboard\Notification\ActivityStreamNotification', true);
return $type;
};
diff --git a/tests/units/Notification/MailTest.php b/tests/units/Notification/MailTest.php
index 7dc6aaef..8d32b497 100644
--- a/tests/units/Notification/MailTest.php
+++ b/tests/units/Notification/MailTest.php
@@ -10,14 +10,14 @@ use Kanboard\Model\User;
use Kanboard\Model\TaskFile;
use Kanboard\Model\Project;
use Kanboard\Model\Task;
-use Kanboard\Notification\Mail;
+use Kanboard\Notification\MailNotification;
use Kanboard\Subscriber\NotificationSubscriber;
class MailTest extends Base
{
public function testGetMailContent()
{
- $en = new Mail($this->container);
+ $en = new MailNotification($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
@@ -62,7 +62,7 @@ class MailTest extends Base
public function testSendWithEmailAddress()
{
- $en = new Mail($this->container);
+ $en = new MailNotification($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
@@ -93,7 +93,7 @@ class MailTest extends Base
public function testSendWithoutEmailAddress()
{
- $en = new Mail($this->container);
+ $en = new MailNotification($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);