blob: 2f6a90b5a0039ba8bfd446cbbb5d0c572b75bdb2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
<?php
use Kanboard\EventBuilder\CommentEventBuilder;
use Kanboard\Model\CommentModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Model\TaskCreationModel;
require_once __DIR__.'/../Base.php';
class CommentEventBuilderTest extends Base
{
public function testWithMissingComment()
{
$commentEventBuilder = new CommentEventBuilder($this->container);
$commentEventBuilder->withCommentId(42);
$this->assertNull($commentEventBuilder->buildEvent());
}
public function testBuild()
{
$commentModel = new CommentModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$projectModel = new ProjectModel($this->container);
$commentEventBuilder = new CommentEventBuilder($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' => 'bla bla', 'user_id' => 1)));
$commentEventBuilder->withCommentId(1);
$event = $commentEventBuilder->buildEvent();
$this->assertInstanceOf('Kanboard\Event\CommentEvent', $event);
$this->assertNotEmpty($event['comment']);
$this->assertNotEmpty($event['task']);
}
}
|