blob: 6fbc349cb94031c8ec3798eb3a4174aaf51ab451 (
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
|
<?php
require_once __DIR__.'/../Base.php';
use Kanboard\Model\ConfigModel;
use Kanboard\Model\TaskCreationModel;
use Kanboard\Model\ProjectModel;
use Kanboard\Subscriber\NotificationSubscriber;
class WebhookNotificationTest extends Base
{
public function testTaskCreation()
{
$configModel = new ConfigModel($this->container);
$projectModel = new ProjectModel($this->container);
$taskCreationModel = new TaskCreationModel($this->container);
$this->container['dispatcher']->addSubscriber(new NotificationSubscriber($this->container));
$configModel->save(array('webhook_url' => 'http://localhost/?task-creation'));
$this->container['httpClient']
->expects($this->once())
->method('postJson')
->with($this->stringContains('http://localhost/?task-creation&token='), $this->anything());
$this->assertEquals(1, $projectModel->create(array('name' => 'test')));
$this->assertEquals(1, $taskCreationModel->create(array('project_id' => 1, 'title' => 'test')));
}
}
|