Add unit tests for last automatic actions
This commit is contained in:
@@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
namespace Kanboard\Controller;
|
namespace Kanboard\Controller;
|
||||||
|
|
||||||
use Kanboard\Model\Project as ProjectModel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Task Duplication controller
|
* Task Duplication controller
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -193,11 +193,12 @@ class Category extends Base
|
|||||||
*/
|
*/
|
||||||
public function duplicate($src_project_id, $dst_project_id)
|
public function duplicate($src_project_id, $dst_project_id)
|
||||||
{
|
{
|
||||||
$categories = $this->db->table(self::TABLE)
|
$categories = $this->db
|
||||||
->columns('name')
|
->table(self::TABLE)
|
||||||
->eq('project_id', $src_project_id)
|
->columns('name')
|
||||||
->asc('name')
|
->eq('project_id', $src_project_id)
|
||||||
->findAll();
|
->asc('name')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
foreach ($categories as $category) {
|
foreach ($categories as $category) {
|
||||||
$category['project_id'] = $dst_project_id;
|
$category['project_id'] = $dst_project_id;
|
||||||
|
|||||||
@@ -39,14 +39,14 @@ class LastLogin extends Base
|
|||||||
$this->cleanup($user_id);
|
$this->cleanup($user_id);
|
||||||
|
|
||||||
return $this->db
|
return $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->insert(array(
|
->insert(array(
|
||||||
'auth_type' => $auth_type,
|
'auth_type' => $auth_type,
|
||||||
'user_id' => $user_id,
|
'user_id' => $user_id,
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'user_agent' => substr($user_agent, 0, 255),
|
'user_agent' => substr($user_agent, 0, 255),
|
||||||
'date_creation' => time(),
|
'date_creation' => time(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class ProjectDuplication extends Base
|
|||||||
* Get list of optional models to duplicate
|
* Get list of optional models to duplicate
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getOptionalSelection()
|
public function getOptionalSelection()
|
||||||
{
|
{
|
||||||
@@ -28,7 +28,7 @@ class ProjectDuplication extends Base
|
|||||||
* Get list of all possible models to duplicate
|
* Get list of all possible models to duplicate
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return array
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
public function getPossibleSelection()
|
public function getPossibleSelection()
|
||||||
{
|
{
|
||||||
@@ -71,7 +71,7 @@ class ProjectDuplication extends Base
|
|||||||
// Get the cloned project Id
|
// Get the cloned project Id
|
||||||
$dst_project_id = $this->copy($src_project_id, $owner_id, $name, $private);
|
$dst_project_id = $this->copy($src_project_id, $owner_id, $name, $private);
|
||||||
|
|
||||||
if (! $dst_project_id) {
|
if ($dst_project_id === false) {
|
||||||
$this->db->cancelTransaction();
|
$this->db->cancelTransaction();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -435,10 +435,10 @@ class Subtask extends Base
|
|||||||
return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) {
|
return $this->db->transaction(function (Database $db) use ($src_task_id, $dst_task_id) {
|
||||||
|
|
||||||
$subtasks = $db->table(Subtask::TABLE)
|
$subtasks = $db->table(Subtask::TABLE)
|
||||||
->columns('title', 'time_estimated', 'position')
|
->columns('title', 'time_estimated', 'position')
|
||||||
->eq('task_id', $src_task_id)
|
->eq('task_id', $src_task_id)
|
||||||
->asc('position')
|
->asc('position')
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
foreach ($subtasks as &$subtask) {
|
foreach ($subtasks as &$subtask) {
|
||||||
$subtask['task_id'] = $dst_task_id;
|
$subtask['task_id'] = $dst_task_id;
|
||||||
|
|||||||
@@ -302,11 +302,11 @@ class SubtaskTimeTracking extends Base
|
|||||||
{
|
{
|
||||||
$hook = 'model:subtask-time-tracking:calculate:time-spent';
|
$hook = 'model:subtask-time-tracking:calculate:time-spent';
|
||||||
$start_time = $this->db
|
$start_time = $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->eq('subtask_id', $subtask_id)
|
->eq('subtask_id', $subtask_id)
|
||||||
->eq('user_id', $user_id)
|
->eq('user_id', $user_id)
|
||||||
->eq('end', 0)
|
->eq('end', 0)
|
||||||
->findOneColumn('start');
|
->findOneColumn('start');
|
||||||
|
|
||||||
if (empty($start_time)) {
|
if (empty($start_time)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -96,10 +96,11 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function getDefault($project_id)
|
public function getDefault($project_id)
|
||||||
{
|
{
|
||||||
$result = $this->db->table(Project::TABLE)
|
$result = $this->db
|
||||||
->eq('id', $project_id)
|
->table(Project::TABLE)
|
||||||
->columns('id', 'default_swimlane', 'show_default_swimlane')
|
->eq('id', $project_id)
|
||||||
->findOne();
|
->columns('id', 'default_swimlane', 'show_default_swimlane')
|
||||||
|
->findOne();
|
||||||
|
|
||||||
if ($result['default_swimlane'] === 'Default swimlane') {
|
if ($result['default_swimlane'] === 'Default swimlane') {
|
||||||
$result['default_swimlane'] = t($result['default_swimlane']);
|
$result['default_swimlane'] = t($result['default_swimlane']);
|
||||||
@@ -117,10 +118,11 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function getAll($project_id)
|
public function getAll($project_id)
|
||||||
{
|
{
|
||||||
return $this->db->table(self::TABLE)
|
return $this->db
|
||||||
->eq('project_id', $project_id)
|
->table(self::TABLE)
|
||||||
->orderBy('position', 'asc')
|
->eq('project_id', $project_id)
|
||||||
->findAll();
|
->orderBy('position', 'asc')
|
||||||
|
->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -133,9 +135,10 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function getAllByStatus($project_id, $status = self::ACTIVE)
|
public function getAllByStatus($project_id, $status = self::ACTIVE)
|
||||||
{
|
{
|
||||||
$query = $this->db->table(self::TABLE)
|
$query = $this->db
|
||||||
->eq('project_id', $project_id)
|
->table(self::TABLE)
|
||||||
->eq('is_active', $status);
|
->eq('project_id', $project_id)
|
||||||
|
->eq('is_active', $status);
|
||||||
|
|
||||||
if ($status == self::ACTIVE) {
|
if ($status == self::ACTIVE) {
|
||||||
$query->asc('position');
|
$query->asc('position');
|
||||||
@@ -155,17 +158,19 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function getSwimlanes($project_id)
|
public function getSwimlanes($project_id)
|
||||||
{
|
{
|
||||||
$swimlanes = $this->db->table(self::TABLE)
|
$swimlanes = $this->db
|
||||||
->columns('id', 'name', 'description')
|
->table(self::TABLE)
|
||||||
->eq('project_id', $project_id)
|
->columns('id', 'name', 'description')
|
||||||
->eq('is_active', self::ACTIVE)
|
->eq('project_id', $project_id)
|
||||||
->orderBy('position', 'asc')
|
->eq('is_active', self::ACTIVE)
|
||||||
->findAll();
|
->orderBy('position', 'asc')
|
||||||
|
->findAll();
|
||||||
|
|
||||||
$default_swimlane = $this->db->table(Project::TABLE)
|
$default_swimlane = $this->db
|
||||||
->eq('id', $project_id)
|
->table(Project::TABLE)
|
||||||
->eq('show_default_swimlane', 1)
|
->eq('id', $project_id)
|
||||||
->findOneColumn('default_swimlane');
|
->eq('show_default_swimlane', 1)
|
||||||
|
->findOneColumn('default_swimlane');
|
||||||
|
|
||||||
if ($default_swimlane) {
|
if ($default_swimlane) {
|
||||||
if ($default_swimlane === 'Default swimlane') {
|
if ($default_swimlane === 'Default swimlane') {
|
||||||
@@ -200,11 +205,12 @@ class Swimlane extends Base
|
|||||||
$swimlanes[0] = $default === 'Default swimlane' ? t($default) : $default;
|
$swimlanes[0] = $default === 'Default swimlane' ? t($default) : $default;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $swimlanes + $this->db->hashtable(self::TABLE)
|
return $swimlanes + $this->db
|
||||||
->eq('project_id', $project_id)
|
->hashtable(self::TABLE)
|
||||||
->in('is_active', $only_active ? array(self::ACTIVE) : array(self::ACTIVE, self::INACTIVE))
|
->eq('project_id', $project_id)
|
||||||
->orderBy('position', 'asc')
|
->in('is_active', $only_active ? array(self::ACTIVE) : array(self::ACTIVE, self::INACTIVE))
|
||||||
->getAll('id', 'name');
|
->orderBy('position', 'asc')
|
||||||
|
->getAll('id', 'name');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,9 +238,10 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function update(array $values)
|
public function update(array $values)
|
||||||
{
|
{
|
||||||
return $this->db->table(self::TABLE)
|
return $this->db
|
||||||
->eq('id', $values['id'])
|
->table(self::TABLE)
|
||||||
->update($values);
|
->eq('id', $values['id'])
|
||||||
|
->update($values);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -247,12 +254,12 @@ class Swimlane extends Base
|
|||||||
public function updateDefault(array $values)
|
public function updateDefault(array $values)
|
||||||
{
|
{
|
||||||
return $this->db
|
return $this->db
|
||||||
->table(Project::TABLE)
|
->table(Project::TABLE)
|
||||||
->eq('id', $values['id'])
|
->eq('id', $values['id'])
|
||||||
->update(array(
|
->update(array(
|
||||||
'default_swimlane' => $values['default_swimlane'],
|
'default_swimlane' => $values['default_swimlane'],
|
||||||
'show_default_swimlane' => $values['show_default_swimlane'],
|
'show_default_swimlane' => $values['show_default_swimlane'],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -264,10 +271,11 @@ class Swimlane extends Base
|
|||||||
*/
|
*/
|
||||||
public function getLastPosition($project_id)
|
public function getLastPosition($project_id)
|
||||||
{
|
{
|
||||||
return $this->db->table(self::TABLE)
|
return $this->db
|
||||||
->eq('project_id', $project_id)
|
->table(self::TABLE)
|
||||||
->eq('is_active', 1)
|
->eq('project_id', $project_id)
|
||||||
->count() + 1;
|
->eq('is_active', 1)
|
||||||
|
->count() + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -281,12 +289,12 @@ class Swimlane extends Base
|
|||||||
public function disable($project_id, $swimlane_id)
|
public function disable($project_id, $swimlane_id)
|
||||||
{
|
{
|
||||||
$result = $this->db
|
$result = $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->eq('id', $swimlane_id)
|
->eq('id', $swimlane_id)
|
||||||
->update(array(
|
->update(array(
|
||||||
'is_active' => self::INACTIVE,
|
'is_active' => self::INACTIVE,
|
||||||
'position' => 0,
|
'position' => 0,
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($result) {
|
if ($result) {
|
||||||
// Re-order positions
|
// Re-order positions
|
||||||
@@ -307,12 +315,12 @@ class Swimlane extends Base
|
|||||||
public function enable($project_id, $swimlane_id)
|
public function enable($project_id, $swimlane_id)
|
||||||
{
|
{
|
||||||
return $this->db
|
return $this->db
|
||||||
->table(self::TABLE)
|
->table(self::TABLE)
|
||||||
->eq('id', $swimlane_id)
|
->eq('id', $swimlane_id)
|
||||||
->update(array(
|
->update(array(
|
||||||
'is_active' => self::ACTIVE,
|
'is_active' => self::ACTIVE,
|
||||||
'position' => $this->getLastPosition($project_id),
|
'position' => $this->getLastPosition($project_id),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -353,11 +361,12 @@ class Swimlane extends Base
|
|||||||
public function updatePositions($project_id)
|
public function updatePositions($project_id)
|
||||||
{
|
{
|
||||||
$position = 0;
|
$position = 0;
|
||||||
$swimlanes = $this->db->table(self::TABLE)
|
$swimlanes = $this->db
|
||||||
->eq('project_id', $project_id)
|
->table(self::TABLE)
|
||||||
->eq('is_active', 1)
|
->eq('project_id', $project_id)
|
||||||
->asc('position')
|
->eq('is_active', 1)
|
||||||
->findAllByColumn('id');
|
->asc('position')
|
||||||
|
->findAllByColumn('id');
|
||||||
|
|
||||||
if (! $swimlanes) {
|
if (! $swimlanes) {
|
||||||
return false;
|
return false;
|
||||||
@@ -365,8 +374,8 @@ class Swimlane extends Base
|
|||||||
|
|
||||||
foreach ($swimlanes as $swimlane_id) {
|
foreach ($swimlanes as $swimlane_id) {
|
||||||
$this->db->table(self::TABLE)
|
$this->db->table(self::TABLE)
|
||||||
->eq('id', $swimlane_id)
|
->eq('id', $swimlane_id)
|
||||||
->update(array('position' => ++$position));
|
->update(array('position' => ++$position));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -383,10 +392,10 @@ class Swimlane extends Base
|
|||||||
public function moveDown($project_id, $swimlane_id)
|
public function moveDown($project_id, $swimlane_id)
|
||||||
{
|
{
|
||||||
$swimlanes = $this->db->hashtable(self::TABLE)
|
$swimlanes = $this->db->hashtable(self::TABLE)
|
||||||
->eq('project_id', $project_id)
|
->eq('project_id', $project_id)
|
||||||
->eq('is_active', self::ACTIVE)
|
->eq('is_active', self::ACTIVE)
|
||||||
->asc('position')
|
->asc('position')
|
||||||
->getAll('id', 'position');
|
->getAll('id', 'position');
|
||||||
|
|
||||||
$positions = array_flip($swimlanes);
|
$positions = array_flip($swimlanes);
|
||||||
|
|
||||||
@@ -416,10 +425,10 @@ class Swimlane extends Base
|
|||||||
public function moveUp($project_id, $swimlane_id)
|
public function moveUp($project_id, $swimlane_id)
|
||||||
{
|
{
|
||||||
$swimlanes = $this->db->hashtable(self::TABLE)
|
$swimlanes = $this->db->hashtable(self::TABLE)
|
||||||
->eq('project_id', $project_id)
|
->eq('project_id', $project_id)
|
||||||
->eq('is_active', self::ACTIVE)
|
->eq('is_active', self::ACTIVE)
|
||||||
->asc('position')
|
->asc('position')
|
||||||
->getAll('id', 'position');
|
->getAll('id', 'position');
|
||||||
|
|
||||||
$positions = array_flip($swimlanes);
|
$positions = array_flip($swimlanes);
|
||||||
|
|
||||||
|
|||||||
43
tests/units/Action/TaskCloseNoActivityTest.php
Normal file
43
tests/units/Action/TaskCloseNoActivityTest.php
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__.'/../Base.php';
|
||||||
|
|
||||||
|
use Kanboard\Event\TaskListEvent;
|
||||||
|
use Kanboard\Model\TaskCreation;
|
||||||
|
use Kanboard\Model\TaskFinder;
|
||||||
|
use Kanboard\Model\Project;
|
||||||
|
use Kanboard\Model\Task;
|
||||||
|
use Kanboard\Action\TaskCloseNoActivity;
|
||||||
|
|
||||||
|
class TaskCloseNoActivityTest extends Base
|
||||||
|
{
|
||||||
|
public function testClose()
|
||||||
|
{
|
||||||
|
$projectModel = new Project($this->container);
|
||||||
|
$taskCreationModel = new TaskCreation($this->container);
|
||||||
|
$taskFinderModel = new TaskFinder($this->container);
|
||||||
|
|
||||||
|
$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')));
|
||||||
|
|
||||||
|
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||||
|
|
||||||
|
$tasks = $taskFinderModel->getAll(1);
|
||||||
|
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||||
|
|
||||||
|
$action = new TaskCloseNoActivity($this->container);
|
||||||
|
$action->setProjectId(1);
|
||||||
|
$action->setParam('duration', 2);
|
||||||
|
|
||||||
|
$this->assertTrue($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||||
|
|
||||||
|
$task = $taskFinderModel->getById(1);
|
||||||
|
$this->assertNotEmpty($task);
|
||||||
|
$this->assertEquals(0, $task['is_active']);
|
||||||
|
|
||||||
|
$task = $taskFinderModel->getById(2);
|
||||||
|
$this->assertNotEmpty($task);
|
||||||
|
$this->assertEquals(1, $task['is_active']);
|
||||||
|
}
|
||||||
|
}
|
||||||
103
tests/units/Action/TaskEmailNoActivityTest.php
Normal file
103
tests/units/Action/TaskEmailNoActivityTest.php
Normal file
@@ -0,0 +1,103 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once __DIR__.'/../Base.php';
|
||||||
|
|
||||||
|
use Kanboard\Event\TaskListEvent;
|
||||||
|
use Kanboard\Model\TaskCreation;
|
||||||
|
use Kanboard\Model\TaskFinder;
|
||||||
|
use Kanboard\Model\Project;
|
||||||
|
use Kanboard\Model\Task;
|
||||||
|
use Kanboard\Model\User;
|
||||||
|
use Kanboard\Action\TaskEmailNoActivity;
|
||||||
|
|
||||||
|
class TaskEmailNoActivityTest extends Base
|
||||||
|
{
|
||||||
|
public function testSendEmail()
|
||||||
|
{
|
||||||
|
$userModel = new User($this->container);
|
||||||
|
$projectModel = new Project($this->container);
|
||||||
|
$taskCreationModel = new TaskCreation($this->container);
|
||||||
|
$taskFinderModel = new TaskFinder($this->container);
|
||||||
|
|
||||||
|
$this->assertEquals(2, $userModel->create(array('username' => 'test', 'email' => 'chuck@norris', 'name' => 'Chuck Norris')));
|
||||||
|
$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')));
|
||||||
|
|
||||||
|
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||||
|
|
||||||
|
$tasks = $taskFinderModel->getAll(1);
|
||||||
|
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||||
|
|
||||||
|
$action = new TaskEmailNoActivity($this->container);
|
||||||
|
$action->setProjectId(1);
|
||||||
|
$action->setParam('user_id', 2);
|
||||||
|
$action->setParam('subject', 'Old tasks');
|
||||||
|
$action->setParam('duration', 2);
|
||||||
|
|
||||||
|
$this->container['emailClient']
|
||||||
|
->expects($this->once())
|
||||||
|
->method('send')
|
||||||
|
->with('chuck@norris', 'Chuck Norris', 'Old tasks', $this->anything());
|
||||||
|
|
||||||
|
$this->assertTrue($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testUserWithNoEmail()
|
||||||
|
{
|
||||||
|
$userModel = new User($this->container);
|
||||||
|
$projectModel = new Project($this->container);
|
||||||
|
$taskCreationModel = new TaskCreation($this->container);
|
||||||
|
$taskFinderModel = new TaskFinder($this->container);
|
||||||
|
|
||||||
|
$this->assertEquals(2, $userModel->create(array('username' => 'test', 'name' => 'Chuck Norris')));
|
||||||
|
$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')));
|
||||||
|
|
||||||
|
$this->container['db']->table(Task::TABLE)->eq('id', 1)->update(array('date_modification' => strtotime('-10days')));
|
||||||
|
|
||||||
|
$tasks = $taskFinderModel->getAll(1);
|
||||||
|
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||||
|
|
||||||
|
$action = new TaskEmailNoActivity($this->container);
|
||||||
|
$action->setProjectId(1);
|
||||||
|
$action->setParam('user_id', 2);
|
||||||
|
$action->setParam('subject', 'Old tasks');
|
||||||
|
$action->setParam('duration', 2);
|
||||||
|
|
||||||
|
$this->container['emailClient']
|
||||||
|
->expects($this->never())
|
||||||
|
->method('send');
|
||||||
|
|
||||||
|
$this->assertFalse($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testTooRecent()
|
||||||
|
{
|
||||||
|
$userModel = new User($this->container);
|
||||||
|
$projectModel = new Project($this->container);
|
||||||
|
$taskCreationModel = new TaskCreation($this->container);
|
||||||
|
$taskFinderModel = new TaskFinder($this->container);
|
||||||
|
|
||||||
|
$this->assertEquals(2, $userModel->create(array('username' => 'test', 'email' => 'chuck@norris', 'name' => 'Chuck Norris')));
|
||||||
|
$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')));
|
||||||
|
|
||||||
|
$tasks = $taskFinderModel->getAll(1);
|
||||||
|
$event = new TaskListEvent(array('tasks' => $tasks, 'project_id' => 1));
|
||||||
|
|
||||||
|
$action = new TaskEmailNoActivity($this->container);
|
||||||
|
$action->setProjectId(1);
|
||||||
|
$action->setParam('user_id', 2);
|
||||||
|
$action->setParam('subject', 'Old tasks');
|
||||||
|
$action->setParam('duration', 2);
|
||||||
|
|
||||||
|
$this->container['emailClient']
|
||||||
|
->expects($this->never())
|
||||||
|
->method('send');
|
||||||
|
|
||||||
|
$this->assertFalse($action->execute($event, Task::EVENT_DAILY_CRONJOB));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user