当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::create方法代码示例

本文整理汇总了PHP中Model\Project::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::create方法的具体用法?PHP Project::create怎么用?PHP Project::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model\Project的用法示例。


在下文中一共展示了Project::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testExecute

 public function testExecute()
 {
     $action = new Action\TaskDuplicateAnotherProject(1, new Task($this->registry));
     // We create a task in the first column
     $t = new Task($this->registry);
     $p = new Project($this->registry);
     $this->assertEquals(1, $p->create(array('name' => 'project 1')));
     $this->assertEquals(2, $p->create(array('name' => 'project 2')));
     $this->assertEquals(1, $t->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
     // We create an event to move the task to the 2nd column
     $event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 2);
     // Our event should NOT be executed because we define the same project
     $action->setParam('column_id', 2);
     $action->setParam('project_id', 1);
     $this->assertFalse($action->execute($event));
     // Our task should be assigned to the project 1
     $task = $t->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(1, $task['project_id']);
     // We create an event to move the task to the 2nd column
     $event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 2);
     // Our event should be executed because we define a different project
     $action->setParam('column_id', 2);
     $action->setParam('project_id', 2);
     $this->assertTrue($action->execute($event));
     // Our task should be assigned to the project 1
     $task = $t->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(1, $task['project_id']);
     // We should have another task assigned to the project 2
     $task = $t->getById(2);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
 }
开发者ID:cvalenti,项目名称:kanboard,代码行数:34,代码来源:ActionTaskDuplicateAnotherProjectTest.php

示例2: testHandlePayload

 public function testHandlePayload()
 {
     $w = new MailgunWebhook($this->container);
     $p = new Project($this->container);
     $pp = new ProjectPermission($this->container);
     $u = new User($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $this->assertEquals(2, $u->create(array('name' => 'me', 'email' => 'me@localhost')));
     $this->assertEquals(1, $p->create(array('name' => 'test1')));
     $this->assertEquals(2, $p->create(array('name' => 'test2', 'identifier' => 'TEST1')));
     // Empty payload
     $this->assertFalse($w->parsePayload(array()));
     // Unknown user
     $this->assertFalse($w->parsePayload(array('sender' => 'a@b.c', 'subject' => 'Email task', 'recipient' => 'foobar', 'stripped-text' => 'boo')));
     // Project not found
     $this->assertFalse($w->parsePayload(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test@localhost', 'stripped-text' => 'boo')));
     // User is not member
     $this->assertFalse($w->parsePayload(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test1@localhost', 'stripped-text' => 'boo')));
     $this->assertTrue($pp->addMember(2, 2));
     // The task must be created
     $this->assertTrue($w->parsePayload(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test1@localhost', 'stripped-text' => 'boo')));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
     $this->assertEquals('Email task', $task['title']);
     $this->assertEquals('boo', $task['description']);
     $this->assertEquals(2, $task['creator_id']);
 }
开发者ID:rbertani,项目名称:kanboard,代码行数:29,代码来源:MailgunWebhookTest.php

示例3: testExecute

 public function testExecute()
 {
     $action = new Action\TaskMoveAnotherProject($this->container, 1, Task::EVENT_MOVE_COLUMN);
     // We create a task in the first column
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'project 1')));
     $this->assertEquals(2, $p->create(array('name' => 'project 2')));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
     // We create an event to move the task to the 2nd column
     $event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 2);
     // Our event should NOT be executed because we define the same project
     $action->setParam('column_id', 2);
     $action->setParam('project_id', 1);
     $this->assertFalse($action->execute($event));
     // Our task should be assigned to the project 1
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(1, $task['project_id']);
     // We create an event to move the task to the 2nd column
     $event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 2);
     // Our event should be executed because we define a different project
     $action->setParam('column_id', 2);
     $action->setParam('project_id', 2);
     $this->assertTrue($action->execute($event));
     // Our task should be assigned to the project 2
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
 }
开发者ID:andrearruda,项目名称:kanboard,代码行数:31,代码来源:ActionTaskMoveAnotherProjectTest.php

示例4: testGetOverdueTasksByUser

 public function testGetOverdueTasksByUser()
 {
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(2, $p->create(array('name' => 'Project #2')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'owner_id' => 1, 'date_due' => strtotime('-1 day'))));
     $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 2, 'owner_id' => 1, 'date_due' => strtotime('-1 day'))));
     $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 1, 'date_due' => strtotime('+1 day'))));
     $this->assertEquals(4, $tc->create(array('title' => 'Task #4', 'project_id' => 1, 'date_due' => 0)));
     $this->assertEquals(5, $tc->create(array('title' => 'Task #5', 'project_id' => 1)));
     $tasks = $tf->getOverdueTasksByUser(1);
     $this->assertNotEmpty($tasks);
     $this->assertTrue(is_array($tasks));
     $this->assertEquals(2, count($tasks));
     $this->assertEquals(1, $tasks[0]['id']);
     $this->assertEquals('Task #1', $tasks[0]['title']);
     $this->assertEquals(1, $tasks[0]['owner_id']);
     $this->assertEquals(1, $tasks[0]['project_id']);
     $this->assertEquals('Project #1', $tasks[0]['project_name']);
     $this->assertEquals('admin', $tasks[0]['assignee_username']);
     $this->assertEquals('', $tasks[0]['assignee_name']);
     $this->assertEquals('Task #2', $tasks[1]['title']);
 }
开发者ID:redarrow,项目名称:kanboard,代码行数:25,代码来源:TaskFinderTest.php

示例5: testHandlePayload

 public function testHandlePayload()
 {
     $w = new Sendgrid($this->container);
     $p = new Project($this->container);
     $pp = new ProjectPermission($this->container);
     $u = new User($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $this->assertEquals(2, $u->create(array('username' => 'me', 'email' => 'me@localhost')));
     $this->assertEquals(1, $p->create(array('name' => 'test1')));
     $this->assertEquals(2, $p->create(array('name' => 'test2', 'identifier' => 'TEST1')));
     // Empty payload
     $this->assertFalse($w->receiveEmail(array()));
     // Unknown user
     $this->assertFalse($w->receiveEmail(array('envelope' => '{"to":["a@b.c"],"from":"a.b.c"}', 'subject' => 'Email task')));
     // Project not found
     $this->assertFalse($w->receiveEmail(array('envelope' => '{"to":["a@b.c"],"from":"me@localhost"}', 'subject' => 'Email task')));
     // User is not member
     $this->assertFalse($w->receiveEmail(array('envelope' => '{"to":["something+test1@localhost"],"from":"me@localhost"}', 'subject' => 'Email task')));
     $this->assertTrue($pp->addMember(2, 2));
     // The task must be created
     $this->assertTrue($w->receiveEmail(array('envelope' => '{"to":["something+test1@localhost"],"from":"me@localhost"}', 'subject' => 'Email task')));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
     $this->assertEquals('Email task', $task['title']);
     $this->assertEquals('', $task['description']);
     $this->assertEquals(2, $task['creator_id']);
     // Html content
     $this->assertTrue($w->receiveEmail(array('envelope' => '{"to":["something+test1@localhost"],"from":"me@localhost"}', 'subject' => 'Email task', 'html' => '<strong>bold</strong> text')));
     $task = $tf->getById(2);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
     $this->assertEquals('Email task', $task['title']);
     $this->assertEquals('**bold** text', $task['description']);
     $this->assertEquals(2, $task['creator_id']);
     // Text content
     $this->assertTrue($w->receiveEmail(array('envelope' => '{"to":["something+test1@localhost"],"from":"me@localhost"}', 'subject' => 'Email task', 'text' => '**bold** text')));
     $task = $tf->getById(3);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
     $this->assertEquals('Email task', $task['title']);
     $this->assertEquals('**bold** text', $task['description']);
     $this->assertEquals(2, $task['creator_id']);
     // Text + html content
     $this->assertTrue($w->receiveEmail(array('envelope' => '{"to":["something+test1@localhost"],"from":"me@localhost"}', 'subject' => 'Email task', 'html' => '<strong>bold</strong> html', 'text' => '**bold** text')));
     $task = $tf->getById(4);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['project_id']);
     $this->assertEquals('Email task', $task['title']);
     $this->assertEquals('**bold** html', $task['description']);
     $this->assertEquals(2, $task['creator_id']);
 }
开发者ID:redarrow,项目名称:kanboard,代码行数:53,代码来源:SendgridTest.php

示例6: testCountByProject

 public function testCountByProject()
 {
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(2, $p->create(array('name' => 'Project #2')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1)));
     $this->assertEquals(2, $tc->create(array('title' => 'Task #2', 'project_id' => 2)));
     $this->assertEquals(3, $tc->create(array('title' => 'Task #3', 'project_id' => 2)));
     $this->assertEquals(1, $tf->countByProjectId(1));
     $this->assertEquals(2, $tf->countByProjectId(2));
 }
开发者ID:hj3938,项目名称:kanboard,代码行数:13,代码来源:TaskFinderTest.php

示例7: testMoveColumns

 public function testMoveColumns()
 {
     $p = new Project($this->registry);
     $b = new Board($this->registry);
     // We create 2 projects
     $this->assertEquals(1, $p->create(array('name' => 'UnitTest1')));
     $this->assertEquals(2, $p->create(array('name' => 'UnitTest2')));
     // We get the columns of the project 2
     $columns = $b->getColumns(2);
     $columns_id = array_keys($b->getColumnsList(2));
     $this->assertNotEmpty($columns);
     // Initial order: 5, 6, 7, 8
     // Move the column 1 down
     $this->assertEquals(1, $columns[0]['position']);
     $this->assertEquals($columns_id[0], $columns[0]['id']);
     $this->assertEquals(2, $columns[1]['position']);
     $this->assertEquals($columns_id[1], $columns[1]['id']);
     $this->assertTrue($b->moveDown(2, $columns[0]['id']));
     $columns = $b->getColumns(2);
     // Sorted by position
     // New order: 6, 5, 7, 8
     $this->assertEquals(1, $columns[0]['position']);
     $this->assertEquals($columns_id[1], $columns[0]['id']);
     $this->assertEquals(2, $columns[1]['position']);
     $this->assertEquals($columns_id[0], $columns[1]['id']);
     // Move the column 3 up
     $this->assertTrue($b->moveUp(2, $columns[2]['id']));
     $columns = $b->getColumns(2);
     // New order: 6, 7, 5, 8
     $this->assertEquals(1, $columns[0]['position']);
     $this->assertEquals($columns_id[1], $columns[0]['id']);
     $this->assertEquals(2, $columns[1]['position']);
     $this->assertEquals($columns_id[2], $columns[1]['id']);
     $this->assertEquals(3, $columns[2]['position']);
     $this->assertEquals($columns_id[0], $columns[2]['id']);
     // Move column 1 up (must do nothing because it's the first column)
     $this->assertFalse($b->moveUp(2, $columns[0]['id']));
     $columns = $b->getColumns(2);
     // Order: 6, 7, 5, 8
     $this->assertEquals(1, $columns[0]['position']);
     $this->assertEquals($columns_id[1], $columns[0]['id']);
     // Move column 4 down (must do nothing because it's the last column)
     $this->assertFalse($b->moveDown(2, $columns[3]['id']));
     $columns = $b->getColumns(2);
     // Order: 6, 7, 5, 8
     $this->assertEquals(4, $columns[3]['position']);
     $this->assertEquals($columns_id[3], $columns[3]['id']);
 }
开发者ID:Null-Kelvin,项目名称:kanboard,代码行数:48,代码来源:BoardTest.php

示例8: testCloneProjectWithUsers

 public function testCloneProjectWithUsers()
 {
     $p = new Project($this->container);
     $c = new Category($this->container);
     $pp = new ProjectPermission($this->container);
     $u = new User($this->container);
     $this->assertEquals(2, $u->create(array('username' => 'unittest1', 'password' => 'unittest')));
     $this->assertEquals(3, $u->create(array('username' => 'unittest2', 'password' => 'unittest')));
     $this->assertEquals(4, $u->create(array('username' => 'unittest3', 'password' => 'unittest')));
     $this->assertEquals(1, $p->create(array('name' => 'P1')));
     $this->assertTrue($pp->addMember(1, 2));
     $this->assertTrue($pp->addMember(1, 4));
     $this->assertTrue($pp->addManager(1, 3));
     $this->assertTrue($pp->isMember(1, 2));
     $this->assertTrue($pp->isMember(1, 3));
     $this->assertTrue($pp->isMember(1, 4));
     $this->assertFalse($pp->isManager(1, 2));
     $this->assertTrue($pp->isManager(1, 3));
     $this->assertFalse($pp->isManager(1, 4));
     $this->assertEquals(2, $p->duplicate(1));
     $project = $p->getById(2);
     $this->assertNotEmpty($project);
     $this->assertEquals('P1 (Clone)', $project['name']);
     $this->assertEquals(3, count($pp->getMembers(2)));
     $this->assertTrue($pp->isMember(2, 2));
     $this->assertTrue($pp->isMember(2, 3));
     $this->assertTrue($pp->isMember(2, 4));
     $this->assertFalse($pp->isManager(2, 2));
     $this->assertTrue($pp->isManager(2, 3));
     $this->assertFalse($pp->isManager(2, 4));
 }
开发者ID:jasonmoofang,项目名称:kanboard,代码行数:31,代码来源:ProjectDuplicateTest.php

示例9: testStatus

 public function testStatus()
 {
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $ts = new TaskStatus($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
     // The task must be open
     $this->assertTrue($ts->isOpen(1));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(Task::STATUS_OPEN, $task['is_active']);
     $this->assertEquals(0, $task['date_completed']);
     $this->assertEquals(time(), $task['date_modification']);
     // We close the task
     $this->assertTrue($ts->close(1));
     $this->assertTrue($ts->isClosed(1));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(Task::STATUS_CLOSED, $task['is_active']);
     $this->assertEquals(time(), $task['date_completed']);
     $this->assertEquals(time(), $task['date_modification']);
     $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_CLOSE));
     // We open the task again
     $this->assertTrue($ts->open(1));
     $this->assertTrue($ts->isOpen(1));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(Task::STATUS_OPEN, $task['is_active']);
     $this->assertEquals(0, $task['date_completed']);
     $this->assertEquals(time(), $task['date_modification']);
     $this->assertTrue($this->container['event']->isEventTriggered(Task::EVENT_OPEN));
 }
开发者ID:andrearruda,项目名称:kanboard,代码行数:34,代码来源:TaskStatusTest.php

示例10: testCleanup

 public function testCleanup()
 {
     $e = new TaskHistory($this->registry);
     $t = new Task($this->registry);
     $p = new Project($this->registry);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $t->create(array('title' => 'Task #1', 'project_id' => 1)));
     $max = 15;
     $nb_events = 100;
     for ($i = 0; $i < $nb_events; $i++) {
         $this->assertTrue($e->create(1, 1, 1, Task::EVENT_CLOSE));
     }
     $this->assertEquals($nb_events, $this->registry->db->table('task_has_events')->count());
     $e->cleanup($max);
     $events = $e->getAllByProjectId(1);
     $this->assertNotEmpty($events);
     $this->assertTrue(is_array($events));
     $this->assertEquals($max, count($events));
     $this->assertEquals(100, $events[0]['id']);
     $this->assertEquals(99, $events[1]['id']);
     $this->assertEquals(86, $events[14]['id']);
     // Cleanup during task creation
     $nb_events = TaskHistory::MAX_EVENTS + 10;
     for ($i = 0; $i < $nb_events; $i++) {
         $this->assertTrue($e->create(1, 1, 1, Task::EVENT_CLOSE));
     }
     $this->assertEquals(TaskHistory::MAX_EVENTS, $this->registry->db->table('task_has_events')->count());
 }
开发者ID:Null-Kelvin,项目名称:kanboard,代码行数:28,代码来源:TaskHistoryTest.php

示例11: testExecute

 public function testExecute()
 {
     $action = new Action\TaskMoveColumnCategoryChange($this->container, 1, Task::EVENT_UPDATE);
     $action->setParam('dest_column_id', 3);
     $action->setParam('category_id', 1);
     $this->assertEquals(3, $action->getParam('dest_column_id'));
     $this->assertEquals(1, $action->getParam('category_id'));
     // We create a task in the first column
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $c = new Category($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $c->create(array('name' => 'bug', 'project_id' => 1)));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1)));
     // No category should be assigned + column_id=1
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEmpty($task['category_id']);
     $this->assertEquals(1, $task['column_id']);
     // We create an event to move the task to the 2nd column
     $event = array('task_id' => 1, 'column_id' => 1, 'project_id' => 1, 'category_id' => 1);
     // Our event should be executed
     $this->assertTrue($action->hasCompatibleEvent());
     $this->assertTrue($action->hasRequiredProject($event));
     $this->assertTrue($action->hasRequiredParameters($event));
     $this->assertTrue($action->hasRequiredCondition($event));
     $this->assertTrue($action->isExecutable($event));
     $this->assertTrue($action->execute(new GenericEvent($event)));
     // Our task should be moved to the other column
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(3, $task['column_id']);
 }
开发者ID:redarrow,项目名称:kanboard,代码行数:34,代码来源:TaskMoveColumnCategoryChangeTest.php

示例12: testCalculateTime

 public function testCalculateTime()
 {
     $tm = new TaskModification($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $s = new SubTask($this->container);
     $ts = new TimeTracking($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1, 'time_estimated' => 4.5)));
     $this->assertTrue($tm->update(array('id' => 1, 'time_spent' => 3.5)));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(4.5, $task['time_estimated']);
     $this->assertEquals(3.5, $task['time_spent']);
     $timesheet = $ts->getTaskTimesheet($task, array());
     $this->assertNotEmpty($timesheet);
     $this->assertEquals(4.5, $timesheet['time_estimated']);
     $this->assertEquals(3.5, $timesheet['time_spent']);
     $this->assertEquals(1, $timesheet['time_remaining']);
     // Subtasks calculation
     $this->assertEquals(1, $s->create(array('title' => 'subtask #1', 'task_id' => 1, 'time_estimated' => 5.5, 'time_spent' => 3)));
     $this->assertEquals(2, $s->create(array('title' => 'subtask #2', 'task_id' => 1, 'time_estimated' => '', 'time_spent' => 4)));
     $timesheet = $ts->getTaskTimesheet($task, $s->getAll(1));
     $this->assertNotEmpty($timesheet);
     $this->assertEquals(5.5, $timesheet['time_estimated']);
     $this->assertEquals(7, $timesheet['time_spent']);
     $this->assertEquals(-1.5, $timesheet['time_remaining']);
 }
开发者ID:jasonmoofang,项目名称:kanboard,代码行数:29,代码来源:TimeTrackingTest.php

示例13: testCleanup

 public function testCleanup()
 {
     $e = new ProjectActivity($this->container);
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1)));
     $max = 15;
     $nb_events = 100;
     for ($i = 0; $i < $nb_events; $i++) {
         $this->assertTrue($e->createEvent(1, 1, 1, Task::EVENT_CLOSE, array('task' => $tf->getbyId(1))));
     }
     $this->assertEquals($nb_events, $this->container['db']->table('project_activities')->count());
     $e->cleanup($max);
     $events = $e->getProject(1);
     $this->assertNotEmpty($events);
     $this->assertTrue(is_array($events));
     $this->assertEquals($max, count($events));
     $this->assertEquals(100, $events[0]['id']);
     $this->assertEquals(99, $events[1]['id']);
     $this->assertEquals(86, $events[14]['id']);
     // Cleanup during task creation
     $nb_events = ProjectActivity::MAX_EVENTS + 10;
     for ($i = 0; $i < $nb_events; $i++) {
         $this->assertTrue($e->createEvent(1, 1, 1, Task::EVENT_CLOSE, array('task' => $tf->getbyId(1))));
     }
     $this->assertEquals(ProjectActivity::MAX_EVENTS, $this->container['db']->table('project_activities')->count());
 }
开发者ID:rbertani,项目名称:kanboard,代码行数:29,代码来源:ProjectActivityTest.php

示例14: testMoveTaskAnotherSwimlane

 public function testMoveTaskAnotherSwimlane()
 {
     $tp = new TaskPosition($this->container);
     $tc = new TaskCreation($this->container);
     $p = new Project($this->container);
     $tf = new TaskFinder($this->container);
     $s = new Swimlane($this->container);
     $this->container['dispatcher'] = new EventDispatcher();
     $this->container['dispatcher']->addSubscriber(new TaskMovedDateSubscriber($this->container));
     $now = time();
     $this->assertEquals(1, $p->create(array('name' => 'Project #1')));
     $this->assertEquals(1, $s->create(array('project_id' => 1, 'name' => 'S1')));
     $this->assertEquals(2, $s->create(array('project_id' => 1, 'name' => 'S2')));
     $this->assertEquals(1, $tc->create(array('title' => 'Task #1', 'project_id' => 1)));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals($now, $task['date_moved'], '', 1);
     $this->assertEquals(1, $task['column_id']);
     $this->assertEquals(0, $task['swimlane_id']);
     sleep(1);
     $this->assertTrue($tp->movePosition(1, 1, 2, 1, 2));
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertNotEquals($now, $task['date_moved']);
     $this->assertEquals(2, $task['column_id']);
     $this->assertEquals(2, $task['swimlane_id']);
 }
开发者ID:redarrow,项目名称:kanboard,代码行数:27,代码来源:TaskMovedDateSubscriberTest.php

示例15: testExecute

 public function testExecute()
 {
     $action = new Action\TaskAssignColorCategory($this->container, 1, Task::EVENT_CREATE_UPDATE);
     $action->setParam('category_id', 1);
     $action->setParam('color_id', 'blue');
     // We create a task in the first column
     $tc = new TaskCreation($this->container);
     $tf = new TaskFinder($this->container);
     $p = new Project($this->container);
     $c = new Category($this->container);
     $this->assertEquals(1, $p->create(array('name' => 'test')));
     $this->assertEquals(1, $c->create(array('name' => 'c1')));
     $this->assertEquals(2, $c->create(array('name' => 'c2')));
     $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1, 'color_id' => 'green', 'category_id' => 2)));
     // We create an event but we don't do anything
     $event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'category_id' => 2, 'position' => 2);
     // Our event should NOT be executed
     $this->assertFalse($action->execute($event));
     // Our task should be assigned to the ategory_id=1 and have the green color
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals(2, $task['category_id']);
     $this->assertEquals('green', $task['color_id']);
     // We create an event to move the task
     $event = array('project_id' => 1, 'task_id' => 1, 'column_id' => 1, 'position' => 5, 'category_id' => 1);
     // Our event should be executed
     $this->assertTrue($action->execute($event));
     // Our task should have the blue color
     $task = $tf->getById(1);
     $this->assertNotEmpty($task);
     $this->assertEquals('blue', $task['color_id']);
 }
开发者ID:andrearruda,项目名称:kanboard,代码行数:32,代码来源:ActionTaskAssignColorCategoryTest.php


注:本文中的Model\Project::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。