From e31dbe18ce4f156c7a0fcb286c60c9b2617c2f47 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 30 Jan 2016 07:47:16 -0500 Subject: Load ActionProvider in unit tests --- tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php | 3 ++- tests/units/Base.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php b/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php index 75cb181d..8eb370a2 100644 --- a/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php +++ b/tests/units/Analytic/AverageTimeSpentColumnAnalyticTest.php @@ -16,13 +16,14 @@ class AverageTimeSpentColumnAnalyticTest extends Base $taskCreationModel = new TaskCreation($this->container); $projectModel = new Project($this->container); $averageLeadCycleTimeAnalytic = new AverageTimeSpentColumnAnalytic($this->container); - $now = time(); $this->assertEquals(1, $projectModel->create(array('name' => 'test1'))); $this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); $this->assertEquals(2, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test'))); + $now = time(); + $this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_completed' => $now + 3600)); $this->container['db']->table(Task::TABLE)->eq('id', 2)->update(array('date_completed' => $now + 1800)); diff --git a/tests/units/Base.php b/tests/units/Base.php index 1eb9a9df..bfcef418 100644 --- a/tests/units/Base.php +++ b/tests/units/Base.php @@ -10,7 +10,7 @@ use SimpleLogger\Logger; use SimpleLogger\File; use Kanboard\Core\Session\FlashMessage; use Kanboard\Core\Session\SessionStorage; -use Kanboard\Core\Action\ActionManager; +use Kanboard\ServiceProvider\ActionProvider; class FakeHttpClient { @@ -105,9 +105,9 @@ abstract class Base extends PHPUnit_Framework_TestCase ->getMock(); $this->container['sessionStorage'] = new SessionStorage; - $this->container['actionManager'] = new ActionManager($this->container); + $this->container->register(new ActionProvider); - $this->container['flash'] = function($c) { + $this->container['flash'] = function ($c) { return new FlashMessage($c); }; } -- cgit v1.2.3