summaryrefslogtreecommitdiff
path: root/tests/units/MailgunWebhookTest.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-06-07 22:17:50 -0400
committerFrederic Guillot <fred@kanboard.net>2015-06-07 22:17:50 -0400
commite22da9d32addefa8d739171febcf6f6d0c06ba7b (patch)
treeaffb9f8729ac9d4f07dd7f24dff39bfaa9cda0ff /tests/units/MailgunWebhookTest.php
parent4f32352fe62e47ad5ea760eb00493bdc061b2407 (diff)
Add Mailgun API as mail transport
Diffstat (limited to 'tests/units/MailgunWebhookTest.php')
-rw-r--r--tests/units/MailgunWebhookTest.php51
1 files changed, 0 insertions, 51 deletions
diff --git a/tests/units/MailgunWebhookTest.php b/tests/units/MailgunWebhookTest.php
deleted file mode 100644
index c2745180..00000000
--- a/tests/units/MailgunWebhookTest.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?php
-
-require_once __DIR__.'/Base.php';
-
-use Integration\MailgunWebhook;
-use Model\TaskCreation;
-use Model\TaskFinder;
-use Model\Project;
-use Model\ProjectPermission;
-use Model\User;
-
-class MailgunWebhookTest extends Base
-{
- public function testHandlePayload()
- {
- $w = new MailgunWebhook($this->container);
- $p = new Project($this->container);
- $pp = new ProjectPermission($this->container);
- $u = new User($this->container);
- $tc = new TaskCreation($this->container);
- $tf = new TaskFinder($this->container);
-
- $this->assertEquals(2, $u->create(array('name' => 'me', 'email' => 'me@localhost')));
-
- $this->assertEquals(1, $p->create(array('name' => 'test1')));
- $this->assertEquals(2, $p->create(array('name' => 'test2', 'identifier' => 'TEST1')));
-
- // Empty payload
- $this->assertFalse($w->parsePayload(array()));
-
- // Unknown user
- $this->assertFalse($w->parsePayload(array('sender' => 'a@b.c', 'subject' => 'Email task', 'recipient' => 'foobar', 'stripped-text' => 'boo')));
-
- // Project not found
- $this->assertFalse($w->parsePayload(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test@localhost', 'stripped-text' => 'boo')));
-
- // User is not member
- $this->assertFalse($w->parsePayload(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test1@localhost', 'stripped-text' => 'boo')));
- $this->assertTrue($pp->addMember(2, 2));
-
- // The task must be created
- $this->assertTrue($w->parsePayload(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test1@localhost', 'stripped-text' => 'boo')));
-
- $task = $tf->getById(1);
- $this->assertNotEmpty($task);
- $this->assertEquals(2, $task['project_id']);
- $this->assertEquals('Email task', $task['title']);
- $this->assertEquals('boo', $task['description']);
- $this->assertEquals(2, $task['creator_id']);
- }
-}