summaryrefslogtreecommitdiff
path: root/tests/units
diff options
context:
space:
mode:
Diffstat (limited to 'tests/units')
-rw-r--r--tests/units/Model/ProjectActivityTest.php22
1 files changed, 11 insertions, 11 deletions
diff --git a/tests/units/Model/ProjectActivityTest.php b/tests/units/Model/ProjectActivityTest.php
index 0b87b515..f3d37acb 100644
--- a/tests/units/Model/ProjectActivityTest.php
+++ b/tests/units/Model/ProjectActivityTest.php
@@ -43,23 +43,23 @@ class ProjectActivityTest extends Base
$this->assertEquals(1, $projectModel->create(array('name' => 'Project #1')));
$this->assertEquals(1, $taskCreation->create(array('title' => 'Task #1', 'project_id' => 1)));
- $max = 15;
- $nb_events = 100;
+ $nbEvents = 100;
$task = $taskFinder->getById(1);
- for ($i = 0; $i < $nb_events; $i++) {
+ for ($i = 0; $i < $nbEvents; $i++) {
$this->assertTrue($projectActivity->createEvent(1, 1, 1, TaskModel::EVENT_CLOSE, array('task' => $task)));
}
- $this->assertEquals($nb_events, $this->container['db']->table('project_activities')->count());
- $projectActivity->cleanup($max);
+ $this->assertEquals($nbEvents, $this->container['db']->table('project_activities')->count());
+ $projectActivity->cleanup(strtotime('-12 months'));
+ $this->assertEquals($nbEvents, $this->container['db']->table('project_activities')->count());
+
+ $this->container['db']->table('project_activities')->in('id', array(1, 2, 3))->update(array(
+ 'date_creation' => strtotime('-13 months')
+ ));
- $events = $projectActivity->getQuery()->desc('id')->findAll();
- $this->assertNotEmpty($events);
- $this->assertCount($max, $events);
- $this->assertEquals(100, $events[0]['id']);
- $this->assertEquals(99, $events[1]['id']);
- $this->assertEquals(86, $events[14]['id']);
+ $projectActivity->cleanup(strtotime('-12 months'));
+ $this->assertEquals($nbEvents - 3, $this->container['db']->table('project_activities')->count());
}
}