Make user mentions great again
This commit is contained in:
@@ -49,4 +49,46 @@ class CommentEventJobTest extends Base
|
||||
$this->assertArrayHasKey(CommentModel::EVENT_UPDATE.'.closure', $called);
|
||||
$this->assertArrayHasKey(CommentModel::EVENT_DELETE.'.closure', $called);
|
||||
}
|
||||
|
||||
public function testThatUserMentionJobIsCalled()
|
||||
{
|
||||
$comment = 'some comment';
|
||||
|
||||
$this->container['queueManager'] = $this
|
||||
->getMockBuilder('\Kanboard\Core\Queue\QueueManager')
|
||||
->setConstructorArgs(array($this->container))
|
||||
->setMethods(array(
|
||||
'push',
|
||||
))
|
||||
->getMock();
|
||||
|
||||
$this->container['userMentionJob'] = $this
|
||||
->getMockBuilder('\Kanboard\Job\UserMentionJob')
|
||||
->setConstructorArgs(array($this->container))
|
||||
->setMethods(array(
|
||||
'withParams',
|
||||
))
|
||||
->getMock();
|
||||
|
||||
$this->container['queueManager']
|
||||
->expects($this->any())
|
||||
->method('push');
|
||||
|
||||
$this->container['userMentionJob']
|
||||
->expects($this->once())
|
||||
->method('withParams')
|
||||
->with($comment, CommentModel::EVENT_USER_MENTION, $this->anything())
|
||||
->will($this->returnValue($this->container['userMentionJob']));
|
||||
|
||||
$commentModel = new CommentModel($this->container);
|
||||
$taskCreationModel = new TaskCreationModel($this->container);
|
||||
$projectModel = new ProjectModel($this->container);
|
||||
$commentEventJob = new CommentEventJob($this->container);
|
||||
|
||||
$this->assertEquals(1, $projectModel->create(array('name' => 'test1')));
|
||||
$this->assertEquals(1, $taskCreationModel->create(array('title' => 'test', 'project_id' => 1)));
|
||||
$this->assertEquals(1, $commentModel->create(array('task_id' => 1, 'comment' => $comment, 'user_id' => 1)));
|
||||
|
||||
$commentEventJob->execute(1, CommentModel::EVENT_CREATE);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user