本文整理汇总了PHP中Kanboard\Model\TaskFinder类的典型用法代码示例。如果您正苦于以下问题:PHP TaskFinder类的具体用法?PHP TaskFinder怎么用?PHP TaskFinder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TaskFinder类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testExecute
public function testExecute()
{
$action = new 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', 'project_id' => 1)));
$this->assertEquals(2, $c->create(array('name' => 'c2', 'project_id' => 1)));
$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(new GenericEvent($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(new GenericEvent($event)));
// Our task should have the blue color
$task = $tf->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals('blue', $task['color_id']);
}
开发者ID:Folcky,项目名称:kanboard,代码行数:32,代码来源:TaskAssignColorCategoryTest.php
示例2: testExecute
public function testExecute()
{
$action = new 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:Folcky,项目名称:kanboard,代码行数:34,代码来源:TaskMoveColumnCategoryChangeTest.php
示例3: 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:Folcky,项目名称:kanboard,代码行数:27,代码来源:TaskMovedDateSubscriberTest.php
示例4: testHandlePayload
public function testHandlePayload()
{
$w = new EmailHandler($this->container);
$p = new Project($this->container);
$pp = new ProjectUserRole($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('sender' => '[email protected]', 'subject' => 'Email task', 'recipient' => 'foobar', 'stripped-text' => 'boo')));
// Project not found
$this->assertFalse($w->receiveEmail(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test@localhost', 'stripped-text' => 'boo')));
// User is not member
$this->assertFalse($w->receiveEmail(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test1@localhost', 'stripped-text' => 'boo')));
$this->assertTrue($pp->addUser(2, 2, Role::PROJECT_MEMBER));
// The task must be created
$this->assertTrue($w->receiveEmail(array('sender' => 'me@localhost', 'subject' => 'Email task', 'recipient' => 'foo+test1@localhost', 'stripped-html' => '<strong>boo</strong>')));
$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:scunnin,项目名称:item-file_kanboard,代码行数:29,代码来源:EmailHandlerTest.php
示例5: testExecute
public function testExecute()
{
$action = new TaskAssignColorUser($this->container, 1, Task::EVENT_ASSIGNEE_CHANGE);
$action->setParam('user_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);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1, 'color_id' => 'green')));
// We change the assignee
$event = array('project_id' => 1, 'task_id' => 1, 'owner_id' => 5);
// Our event should NOT be executed
$this->assertFalse($action->execute(new GenericEvent($event)));
// Our task should be assigned to nobody and have the green color
$task = $tf->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals(0, $task['owner_id']);
$this->assertEquals('green', $task['color_id']);
// We change the assignee
$event = array('project_id' => 1, 'task_id' => 1, 'owner_id' => 1);
// Our event should be executed
$this->assertTrue($action->execute(new GenericEvent($event)));
// Our task should be assigned to nobody and have the blue color
$task = $tf->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals(0, $task['owner_id']);
$this->assertEquals('blue', $task['color_id']);
}
开发者ID:Folcky,项目名称:kanboard,代码行数:30,代码来源:TaskAssignColorUserTest.php
示例6: testGetTitle
public function testGetTitle()
{
$wn = new Notification($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
$s = new Subtask($this->container);
$c = new Comment($this->container);
$f = new TaskFile($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
$this->assertEquals(1, $s->create(array('title' => 'test', 'task_id' => 1)));
$this->assertEquals(1, $c->create(array('comment' => 'test', 'task_id' => 1, 'user_id' => 1)));
$this->assertEquals(1, $f->create(1, 'test', 'blah', 123));
$task = $tf->getDetails(1);
$subtask = $s->getById(1, true);
$comment = $c->getById(1);
$file = $c->getById(1);
$this->assertNotEmpty($task);
$this->assertNotEmpty($subtask);
$this->assertNotEmpty($comment);
$this->assertNotEmpty($file);
foreach (NotificationSubscriber::getSubscribedEvents() as $event_name => $values) {
$title = $wn->getTitleWithoutAuthor($event_name, array('task' => $task, 'comment' => $comment, 'subtask' => $subtask, 'file' => $file, 'changes' => array()));
$this->assertNotEmpty($title);
$title = $wn->getTitleWithAuthor('foobar', $event_name, array('task' => $task, 'comment' => $comment, 'subtask' => $subtask, 'file' => $file, 'changes' => array()));
$this->assertNotEmpty($title);
}
$this->assertNotEmpty($wn->getTitleWithoutAuthor(Task::EVENT_OVERDUE, array('tasks' => array(array('id' => 1)))));
$this->assertNotEmpty($wn->getTitleWithoutAuthor('unkown', array()));
}
开发者ID:jclafuente,项目名称:kanboard,代码行数:31,代码来源:NotificationTest.php
示例7: 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:Folcky,项目名称:kanboard,代码行数:29,代码来源:ProjectActivityTest.php
示例8: testAverageWithTransitions
public function testAverageWithTransitions()
{
$transitionModel = new Transition($this->container);
$taskFinderModel = new TaskFinder($this->container);
$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')));
$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));
foreach (array(1, 2) as $task_id) {
$task = $taskFinderModel->getById($task_id);
$task['task_id'] = $task['id'];
$task['date_moved'] = $now - 900;
$task['src_column_id'] = 3;
$task['dst_column_id'] = 1;
$this->assertTrue($transitionModel->save(1, $task));
}
$stats = $averageLeadCycleTimeAnalytic->build(1);
$expected = array(1 => array('count' => 2, 'time_spent' => 3600 + 1800, 'average' => (int) ((3600 + 1800) / 2), 'title' => 'Backlog'), 2 => array('count' => 0, 'time_spent' => 0, 'average' => 0, 'title' => 'Ready'), 3 => array('count' => 2, 'time_spent' => 1800, 'average' => 900, 'title' => 'Work in progress'), 4 => array('count' => 0, 'time_spent' => 0, 'average' => 0, 'title' => 'Done'));
$this->assertEquals($expected, $stats);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:25,代码来源:AverageTimeSpentColumnAnalyticTest.php
示例9: testExecute
public function testExecute()
{
$action = new 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(new GenericEvent($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(new GenericEvent($event)));
// Our task should be assigned to the project 2
$task = $tf->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals(2, $task['project_id']);
}
开发者ID:Folcky,项目名称:kanboard,代码行数:31,代码来源:TaskMoveAnotherProjectTest.php
示例10: 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:perburn,项目名称:kanboard,代码行数:13,代码来源:TaskFinderTest.php
示例11: testSendWithoutEmailAddress
public function testSendWithoutEmailAddress()
{
$en = new Mail($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
$u = new User($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
$this->container['emailClient'] = $this->getMockBuilder('\\Kanboard\\Core\\Mail\\Client')->setConstructorArgs(array($this->container))->setMethods(array('send'))->getMock();
$this->container['emailClient']->expects($this->never())->method('send');
$en->notifyUser($u->getById(1), Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
}
开发者ID:perburn,项目名称:kanboard,代码行数:13,代码来源:MailTest.php
示例12: testGetTaskWithMultipleMilestoneLink
public function testGetTaskWithMultipleMilestoneLink()
{
$tf = new TaskFinder($this->container);
$tl = new TaskLink($this->container);
$p = new Project($this->container);
$tc = new TaskCreation($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('project_id' => 1, 'title' => 'A')));
$this->assertEquals(2, $tc->create(array('project_id' => 1, 'title' => 'B')));
$this->assertEquals(3, $tc->create(array('project_id' => 1, 'title' => 'C')));
$this->assertNotFalse($tl->create(1, 2, 9));
$this->assertNotFalse($tl->create(1, 3, 9));
$task = $tf->getExtendedQuery()->findOne();
$this->assertNotEmpty($task);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:15,代码来源:TaskLinkTest.php
示例13: testSuccess
public function testSuccess()
{
$projectModel = new Project($this->container);
$taskFinderModel = new TaskFinder($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
$event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'title' => 'test123', 'reference' => 'ref123', 'description' => 'test'));
$action = new TaskCreationAction($this->container);
$action->setProjectId(1);
$action->addEvent('test.event', 'Test Event');
$this->assertTrue($action->execute($event, 'test.event'));
$task = $taskFinderModel->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals('test123', $task['title']);
$this->assertEquals('ref123', $task['reference']);
$this->assertEquals('test', $task['description']);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:16,代码来源:TaskCreationTest.php
示例14: testChangeUser
public function testChangeUser()
{
$this->container['sessionStorage']->user = array('id' => 1);
$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')));
$event = new GenericEvent(array('project_id' => 1, 'task_id' => 1));
$action = new TaskAssignCurrentUser($this->container);
$action->setProjectId(1);
$this->assertTrue($action->execute($event, Task::EVENT_CREATE));
$task = $taskFinderModel->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals(1, $task['owner_id']);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:16,代码来源:TaskAssignCurrentUserTest.php
示例15: testClose
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')));
$event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
$action = new TaskUpdateStartDate($this->container);
$action->setProjectId(1);
$action->setParam('column_id', 2);
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
$task = $taskFinderModel->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals(time(), $task['date_started'], 'Date started delta', 2);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:16,代码来源:TaskUpdateStartDateTest.php
示例16: testClose
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')));
$event = new GenericEvent(array('project_id' => 1, 'task_id' => 1));
$action = new TaskClose($this->container);
$action->setProjectId(1);
$action->addEvent('test.event', 'Test Event');
$this->assertTrue($action->execute($event, 'test.event'));
$task = $taskFinderModel->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals(0, $task['is_active']);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:16,代码来源:TaskCloseTest.php
示例17: testNotifyProjectWithWebhookNotConfigured
public function testNotifyProjectWithWebhookNotConfigured()
{
$this->container['httpClient']->expects($this->never())->method('postForm');
$userModel = new User($this->container);
$projectModel = new Project($this->container);
$taskCreationModel = new TaskCreation($this->container);
$taskFinderModel = new TaskFinder($this->container);
$handler = new RocketChat($this->container);
$this->assertEquals(1, $projectModel->create(array('name' => 'test')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
$this->container['projectMetadata']->save(1, array('rocketchat_webhook_url' => ''));
$project = $projectModel->getById(1);
$task = $taskFinderModel->getDetails(1);
$event = array('task' => $task);
$event['task']['task_id'] = $task['id'];
$handler->notifyProject($project, Task::EVENT_MOVE_COLUMN, $event);
}
开发者ID:RocketChat,项目名称:plugin-rocketchat,代码行数:17,代码来源:RocketChatTest.php
示例18: testChangeColumn
public function testChangeColumn()
{
$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')));
$event = new GenericEvent(array('project_id' => 1, 'task_id' => 1, 'column_id' => 2));
$action = new TaskAssignColorColumn($this->container);
$action->setProjectId(1);
$action->setParam('color_id', 'red');
$action->setParam('column_id', 2);
$this->assertTrue($action->execute($event, Task::EVENT_MOVE_COLUMN));
$task = $taskFinderModel->getById(1);
$this->assertNotEmpty($task);
$this->assertEquals('red', $task['color_id']);
}
开发者ID:peripatetic-sojourner,项目名称:kanboard,代码行数:17,代码来源:TaskAssignColorColumnTest.php
示例19: testGetAll
public function testGetAll()
{
$wn = new UserUnreadNotification($this->container);
$p = new Project($this->container);
$tf = new TaskFinder($this->container);
$tc = new TaskCreation($this->container);
$u = new User($this->container);
$this->assertEquals(1, $p->create(array('name' => 'test')));
$this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1)));
$wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
$wn->create(1, Task::EVENT_CREATE, array('task' => $tf->getDetails(1)));
$this->assertEmpty($wn->getAll(2));
$notifications = $wn->getAll(1);
$this->assertCount(2, $notifications);
$this->assertArrayHasKey('title', $notifications[0]);
$this->assertTrue(is_array($notifications[0]['event_data']));
}
开发者ID:perburn,项目名称:kanboard,代码行数:17,代码来源:UserUnreadNotificationTest.php
示例20: testAssignCategory
public function testAssignCategory()
{
$tc = new TaskCreation($this->container);
$tf = new TaskFinder($this->container);
$p = new Project($this->container);
$c = new Category($this->container);
$action = new TaskAssignCategoryLink($this->container);
$action->setProjectId(1);
$action->setParam('category_id', 1);
$action->setParam('link_id', 2);
$this->assertEquals(1, $p->create(array('name' => 'P1')));
$this->assertEquals(1, $c->create(array('name' => 'C1', 'project_id' => 1)));
$this->assertEquals(1, $tc->create(array('title' => 'T1', 'project_id' => 1)));
$event = new TaskLinkEvent(array('project_id' => 1, 'task_id' => 1, 'opposite_task_id' => 2, 'link_id' => 2));
$this->assertTrue($action->execute($event, TaskLink::EVENT_CREATE_UPDATE));
$task = $tf->getById(1);
$this->assertEquals(1, $task['category_id']);
}
开发者ID:Trapulo,项目名称:kanboard,代码行数:18,代码来源:TaskAssignCategoryLinkTest.php
注:本文中的Kanboard\Model\TaskFinder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论