summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-06-01 21:28:24 -0400
committerFrederic Guillot <fred@kanboard.net>2016-06-01 21:28:24 -0400
commitc50255813b1f2de3709b17492d32c9e4ce280236 (patch)
treebac9a31956c558526e831c05c74ef03c676e453b /tests
parentca87b1b60f9b4b49c80920e5009d6fbe4e3fb514 (diff)
Added mail helper
Diffstat (limited to 'tests')
-rw-r--r--tests/units/Core/ToolTest.php15
-rw-r--r--tests/units/Helper/MailHelperTest.php24
-rw-r--r--tests/units/Model/SwimlaneTest.php13
3 files changed, 37 insertions, 15 deletions
diff --git a/tests/units/Core/ToolTest.php b/tests/units/Core/ToolTest.php
deleted file mode 100644
index 2422d73c..00000000
--- a/tests/units/Core/ToolTest.php
+++ /dev/null
@@ -1,15 +0,0 @@
-<?php
-
-require_once __DIR__.'/../Base.php';
-
-use Kanboard\Core\Tool;
-
-class ToolTest extends Base
-{
- public function testMailboxHash()
- {
- $this->assertEquals('test1', Tool::getMailboxHash('a+test1@localhost'));
- $this->assertEquals('', Tool::getMailboxHash('test1@localhost'));
- $this->assertEquals('', Tool::getMailboxHash('test1'));
- }
-}
diff --git a/tests/units/Helper/MailHelperTest.php b/tests/units/Helper/MailHelperTest.php
new file mode 100644
index 00000000..9975dd29
--- /dev/null
+++ b/tests/units/Helper/MailHelperTest.php
@@ -0,0 +1,24 @@
+<?php
+
+require_once __DIR__.'/../Base.php';
+
+use Kanboard\Helper\MailHelper;
+
+class MailHelperTest extends Base
+{
+ public function testMailboxHash()
+ {
+ $helper = new MailHelper($this->container);
+ $this->assertEquals('test1', $helper->getMailboxHash('a+test1@localhost'));
+ $this->assertEquals('', $helper->getMailboxHash('test1@localhost'));
+ $this->assertEquals('', $helper->getMailboxHash('test1'));
+ }
+
+ public function testFilterSubject()
+ {
+ $helper = new MailHelper($this->container);
+ $this->assertEquals('Test', $helper->filterSubject('Test'));
+ $this->assertEquals('Test', $helper->filterSubject('RE: Test'));
+ $this->assertEquals('Test', $helper->filterSubject('FW: Test'));
+ }
+}
diff --git a/tests/units/Model/SwimlaneTest.php b/tests/units/Model/SwimlaneTest.php
index 2594b17a..cf0be169 100644
--- a/tests/units/Model/SwimlaneTest.php
+++ b/tests/units/Model/SwimlaneTest.php
@@ -30,6 +30,19 @@ class SwimlaneTest extends Base
$this->assertEquals('', $s->getNameById(23));
}
+ public function testGetFirstActiveSwimlane()
+ {
+ $projectModel = new ProjectModel($this->container);
+ $swimlaneModel = new SwimlaneModel($this->container);
+
+ $this->assertEquals(1, $projectModel->create(array('name' => 'UnitTest')));
+ $this->assertEquals(1, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #1', 'is_active' => 0)));
+ $this->assertEquals(2, $swimlaneModel->create(array('project_id' => 1, 'name' => 'Swimlane #2')));
+
+ $swimlane = $swimlaneModel->getFirstActiveSwimlane(1);
+ $this->assertEquals(2, $swimlane['id']);
+ }
+
public function testGetList()
{
$p = new ProjectModel($this->container);