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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
<?php
require_once __DIR__.'/BaseIntegrationTest.php';
class ActionTest extends BaseIntegrationTest
{
protected $projectName = 'My project to test actions';
public function testGetAvailableActions()
{
$actions = $this->app->getAvailableActions();
$this->assertNotEmpty($actions);
$this->assertInternalType('array', $actions);
$this->assertArrayHasKey('\Kanboard\Action\TaskCloseColumn', $actions);
}
public function testGetAvailableActionEvents()
{
$events = $this->app->getAvailableActionEvents();
$this->assertNotEmpty($events);
$this->assertInternalType('array', $events);
$this->assertArrayHasKey('task.move.column', $events);
}
public function testGetCompatibleActionEvents()
{
$events = $this->app->getCompatibleActionEvents('\Kanboard\Action\TaskCloseColumn');
$this->assertNotEmpty($events);
$this->assertInternalType('array', $events);
$this->assertArrayHasKey('task.move.column', $events);
}
public function testCRUD()
{
$this->assertCreateTeamProject();
$this->assertCreateAction();
$this->assertGetActions();
$this->assertRemoveAction();
}
public function assertCreateAction()
{
$actionId = $this->app->createAction($this->projectId, 'task.move.column', '\Kanboard\Action\TaskCloseColumn', array('column_id' => 1));
$this->assertNotFalse($actionId);
$this->assertTrue($actionId > 0);
}
public function assertGetActions()
{
$actions = $this->app->getActions($this->projectId);
$this->assertNotEmpty($actions);
$this->assertInternalType('array', $actions);
$this->assertArrayHasKey('id', $actions[0]);
$this->assertArrayHasKey('project_id', $actions[0]);
$this->assertArrayHasKey('event_name', $actions[0]);
$this->assertArrayHasKey('action_name', $actions[0]);
$this->assertArrayHasKey('params', $actions[0]);
$this->assertArrayHasKey('column_id', $actions[0]['params']);
}
public function assertRemoveAction()
{
$actionId = $this->app->createAction($this->projectId, 'task.move.column', '\Kanboard\Action\TaskCloseColumn', array('column_id' => 1));
$this->assertTrue($this->app->removeAction($actionId));
}
}
|