summaryrefslogtreecommitdiff
path: root/tests/units/Formatter
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-04-09 22:42:17 -0400
committerFrederic Guillot <fred@kanboard.net>2016-04-09 22:42:17 -0400
commit11858be4e8d5aba983700c6cba1c4d0a33ea8e9d (patch)
tree38427e86d52185df95e2b891e4bcd50aeb56eeb9 /tests/units/Formatter
parent42813d702d1c3e5659301bc771f8dbb37a6d15cd (diff)
Filter refactoring
Diffstat (limited to 'tests/units/Formatter')
-rw-r--r--tests/units/Formatter/TaskFilterCalendarFormatterTest.php21
-rw-r--r--tests/units/Formatter/TaskFilterGanttFormatterTest.php24
-rw-r--r--tests/units/Formatter/TaskFilterICalendarFormatterTest.php74
3 files changed, 0 insertions, 119 deletions
diff --git a/tests/units/Formatter/TaskFilterCalendarFormatterTest.php b/tests/units/Formatter/TaskFilterCalendarFormatterTest.php
deleted file mode 100644
index 09dd0de6..00000000
--- a/tests/units/Formatter/TaskFilterCalendarFormatterTest.php
+++ /dev/null
@@ -1,21 +0,0 @@
-<?php
-
-require_once __DIR__.'/../Base.php';
-
-use Kanboard\Formatter\TaskFilterCalendarFormatter;
-
-class TaskFilterCalendarFormatterTest extends Base
-{
- public function testCopy()
- {
- $tf = new TaskFilterCalendarFormatter($this->container);
- $filter1 = $tf->create()->setFullDay();
- $filter2 = $tf->copy();
-
- $this->assertTrue($filter1 !== $filter2);
- $this->assertTrue($filter1->query !== $filter2->query);
- $this->assertTrue($filter1->query->condition !== $filter2->query->condition);
- $this->assertTrue($filter1->isFullDay());
- $this->assertFalse($filter2->isFullDay());
- }
-}
diff --git a/tests/units/Formatter/TaskFilterGanttFormatterTest.php b/tests/units/Formatter/TaskFilterGanttFormatterTest.php
deleted file mode 100644
index 14804784..00000000
--- a/tests/units/Formatter/TaskFilterGanttFormatterTest.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-require_once __DIR__.'/../Base.php';
-
-use Kanboard\Formatter\TaskFilterGanttFormatter;
-use Kanboard\Model\Project;
-use Kanboard\Model\TaskCreation;
-use Kanboard\Core\DateParser;
-
-class TaskFilterGanttFormatterTest extends Base
-{
- public function testFormat()
- {
- $dp = new DateParser($this->container);
- $p = new Project($this->container);
- $tc = new TaskCreation($this->container);
- $tf = new TaskFilterGanttFormatter($this->container);
-
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1')));
-
- $this->assertNotEmpty($tf->search('status:open')->format());
- }
-}
diff --git a/tests/units/Formatter/TaskFilterICalendarFormatterTest.php b/tests/units/Formatter/TaskFilterICalendarFormatterTest.php
deleted file mode 100644
index 6de9cf0f..00000000
--- a/tests/units/Formatter/TaskFilterICalendarFormatterTest.php
+++ /dev/null
@@ -1,74 +0,0 @@
-<?php
-
-require_once __DIR__.'/../Base.php';
-
-use Eluceo\iCal\Component\Calendar;
-use Kanboard\Formatter\TaskFilterICalendarFormatter;
-use Kanboard\Model\Project;
-use Kanboard\Model\User;
-use Kanboard\Model\TaskCreation;
-use Kanboard\Core\DateParser;
-use Kanboard\Model\Config;
-
-class TaskFilterICalendarFormatterTest extends Base
-{
- public function testIcalEventsWithCreatorAndDueDate()
- {
- $dp = new DateParser($this->container);
- $p = new Project($this->container);
- $tc = new TaskCreation($this->container);
- $tf = new TaskFilterICalendarFormatter($this->container);
-
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1', 'creator_id' => 1, 'date_due' => $dp->getTimestampFromIsoFormat('-2 days'))));
-
- $ics = $tf->create()
- ->filterByDueDateRange(strtotime('-1 month'), strtotime('+1 month'))
- ->setFullDay()
- ->setCalendar(new Calendar('Kanboard'))
- ->setColumns('date_due')
- ->addFullDayEvents()
- ->format();
-
- $this->assertContains('UID:task-#1-date_due', $ics);
- $this->assertContains('DTSTART;TZID=UTC;VALUE=DATE:'.date('Ymd', strtotime('-2 days')), $ics);
- $this->assertContains('DTEND;TZID=UTC;VALUE=DATE:'.date('Ymd', strtotime('-2 days')), $ics);
- $this->assertContains('URL:http://localhost/?controller=task&action=show&task_id=1&project_id=1', $ics);
- $this->assertContains('SUMMARY:#1 task1', $ics);
- $this->assertContains('ATTENDEE:MAILTO:admin@kanboard.local', $ics);
- $this->assertContains('X-MICROSOFT-CDO-ALLDAYEVENT:TRUE', $ics);
- }
-
- public function testIcalEventsWithAssigneeAndDueDate()
- {
- $dp = new DateParser($this->container);
- $p = new Project($this->container);
- $tc = new TaskCreation($this->container);
- $tf = new TaskFilterICalendarFormatter($this->container);
- $u = new User($this->container);
- $c = new Config($this->container);
-
- $this->assertNotFalse($c->save(array('application_url' => 'http://kb/')));
- $this->assertEquals('http://kb/', $c->get('application_url'));
-
- $this->assertNotFalse($u->update(array('id' => 1, 'email' => 'bob@localhost')));
- $this->assertEquals(1, $p->create(array('name' => 'test')));
- $this->assertNotFalse($tc->create(array('project_id' => 1, 'title' => 'task1', 'owner_id' => 1, 'date_due' => $dp->getTimestampFromIsoFormat('+5 days'))));
-
- $ics = $tf->create()
- ->filterByDueDateRange(strtotime('-1 month'), strtotime('+1 month'))
- ->setFullDay()
- ->setCalendar(new Calendar('Kanboard'))
- ->setColumns('date_due')
- ->addFullDayEvents()
- ->format();
-
- $this->assertContains('UID:task-#1-date_due', $ics);
- $this->assertContains('DTSTART;TZID=UTC;VALUE=DATE:'.date('Ymd', strtotime('+5 days')), $ics);
- $this->assertContains('DTEND;TZID=UTC;VALUE=DATE:'.date('Ymd', strtotime('+5 days')), $ics);
- $this->assertContains('URL:http://kb/?controller=task&action=show&task_id=1&project_id=1', $ics);
- $this->assertContains('SUMMARY:#1 task1', $ics);
- $this->assertContains('ORGANIZER;CN=admin:MAILTO:bob@localhost', $ics);
- $this->assertContains('X-MICROSOFT-CDO-ALLDAYEVENT:TRUE', $ics);
- }
-}