summaryrefslogtreecommitdiff
path: root/tests/integration/ActionProcedureTest.php
diff options
context:
space:
mode:
authorTeamjungla{CODE} <junglacode@gmail.com>2016-08-20 13:47:12 -0500
committerTeamjungla{CODE} <junglacode@gmail.com>2016-08-20 13:47:12 -0500
commitfe8e9cdcfe3afc1475c7e7f4392d2b2cc601a12b (patch)
tree001403874e9e3716de7c6d51a9f536e9b3c3be5e /tests/integration/ActionProcedureTest.php
parentb1e795fc5b45369f7b9b565b1e106d2673361977 (diff)
parent98efcf21e355ed6ac3827058b99df86ca67c75bb (diff)
Merge branch 'stable' of https://github.com/kanboard/kanboard
Diffstat (limited to 'tests/integration/ActionProcedureTest.php')
-rw-r--r--tests/integration/ActionProcedureTest.php66
1 files changed, 66 insertions, 0 deletions
diff --git a/tests/integration/ActionProcedureTest.php b/tests/integration/ActionProcedureTest.php
new file mode 100644
index 00000000..432de3d3
--- /dev/null
+++ b/tests/integration/ActionProcedureTest.php
@@ -0,0 +1,66 @@
+<?php
+
+require_once __DIR__.'/BaseProcedureTest.php';
+
+class ActionProcedureTest extends BaseProcedureTest
+{
+ 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));
+ }
+}