summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
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);