summaryrefslogtreecommitdiff
path: root/tests/units/Notification/WebhookNotificationTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-07-23 14:05:15 -0400
committerFrederic Guillot <fred@kanboard.net>2016-07-23 14:05:15 -0400
commitb6119e7dee84869a619dedccd9c80df4422a4f5b (patch)
tree8487400f592d2c66dba91a9ce4f03b4ae657a0c2 /tests/units/Notification/WebhookNotificationTest.php
parent5fe81ae6ef59ee73e7d6f34fb333d3d19a08a266 (diff)
Added internal task links to activity stream
Diffstat (limited to 'tests/units/Notification/WebhookNotificationTest.php')
-rw-r--r--tests/units/Notification/WebhookNotificationTest.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/units/Notification/WebhookNotificationTest.php b/tests/units/Notification/WebhookNotificationTest.php
new file mode 100644
index 00000000..6fbc349c
--- /dev/null
+++ b/tests/units/Notification/WebhookNotificationTest.php
@@ -0,0 +1,29 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Kanboard\Model\ConfigModel;
+use Kanboard\Model\TaskCreationModel;
+use Kanboard\Model\ProjectModel;
+use Kanboard\Subscriber\NotificationSubscriber;
+
+class WebhookNotificationTest extends Base
+{
+ public function testTaskCreation()
+ {
+ $configModel = new ConfigModel($this->container);
+ $projectModel = new ProjectModel($this->container);
+ $taskCreationModel = new TaskCreationModel($this->container);
+ $this->container['dispatcher']->addSubscriber(new NotificationSubscriber($this->container));
+
+ $configModel->save(array('webhook_url' => 'http://localhost/?task-creation'));
+
+ $this->container['httpClient']
+ ->expects($this->once())
+ ->method('postJson')
+ ->with($this->stringContains('http://localhost/?task-creation&token='), $this->anything());
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'test')));
+ $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
+ }
+}