diff options
Diffstat (limited to 'app/Action')
-rw-r--r-- | app/Action/ActionCommentCreationTest.php | 124 | ||||
-rw-r--r-- | app/Action/CommentCreation.php | 1 | ||||
-rw-r--r-- | app/Action/TaskAssignUser.php | 2 | ||||
-rw-r--r-- | app/Action/TaskClose.php | 4 | ||||
-rw-r--r-- | app/Action/TaskCreation.php | 2 | ||||
-rw-r--r-- | app/Action/TaskOpen.php | 2 |
6 files changed, 11 insertions, 124 deletions
diff --git a/app/Action/ActionCommentCreationTest.php b/app/Action/ActionCommentCreationTest.php deleted file mode 100644 index a4ca284e..00000000 --- a/app/Action/ActionCommentCreationTest.php +++ /dev/null @@ -1,124 +0,0 @@ -<?php - -require_once __DIR__.'/Base.php'; - -use Event\GenericEvent; -use Model\Task; -use Model\TaskCreation; -use Model\Comment; -use Model\Project; -use Integration\GithubWebhook; - -class ActionCommentCreationTest extends Base -{ - public function testWithoutRequiredParams() - { - $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); - - // We create a task in the first column - $tc = new TaskCreation($this->container); - $p = new Project($this->container); - $c = new Comment($this->container); - $this->assertEquals(1, $p->create(array('name' => 'test'))); - $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); - - // We create an event to move the task to the 2nd column - $event = array( - 'project_id' => 1, - 'task_id' => 1, - 'user_id' => 1, - ); - - // Our event should be executed - $this->assertTrue($action->execute(new GenericEvent($event))); - - $comment = $c->getById(1); - $this->assertEmpty($comment); - } - - public function testWithCommitMessage() - { - $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); - - // We create a task in the first column - $tc = new TaskCreation($this->container); - $p = new Project($this->container); - $c = new Comment($this->container); - $this->assertEquals(1, $p->create(array('name' => 'test'))); - $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); - - // We create an event to move the task to the 2nd column - $event = array( - 'project_id' => 1, - 'task_id' => 1, - 'commit_comment' => 'plop', - ); - - // Our event should be executed - $this->assertTrue($action->execute(new GenericEvent($event))); - - $comment = $c->getById(1); - $this->assertNotEmpty($comment); - $this->assertEquals(1, $comment['task_id']); - $this->assertEquals(0, $comment['user_id']); - $this->assertEquals('plop', $comment['comment']); - } - - public function testWithUser() - { - $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); - - // We create a task in the first column - $tc = new TaskCreation($this->container); - $p = new Project($this->container); - $c = new Comment($this->container); - $this->assertEquals(1, $p->create(array('name' => 'test'))); - $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); - - // We create an event to move the task to the 2nd column - $event = array( - 'project_id' => 1, - 'task_id' => 1, - 'user_id' => 1, - 'comment' => 'youpi', - ); - - // Our event should be executed - $this->assertTrue($action->execute(new GenericEvent($event))); - - $comment = $c->getById(1); - $this->assertNotEmpty($comment); - $this->assertEquals(1, $comment['task_id']); - $this->assertEquals(1, $comment['user_id']); - $this->assertEquals('youpi', $comment['comment']); - } - - public function testWithNoUser() - { - $action = new Action\CommentCreation($this->container, 1, GithubWebhook::EVENT_ISSUE_COMMENT); - - // We create a task in the first column - $tc = new TaskCreation($this->container); - $p = new Project($this->container); - $c = new Comment($this->container); - $this->assertEquals(1, $p->create(array('name' => 'test'))); - $this->assertEquals(1, $tc->create(array('title' => 'test', 'project_id' => 1, 'column_id' => 1))); - - // We create an event to move the task to the 2nd column - $event = array( - 'project_id' => 1, - 'task_id' => 1, - 'user_id' => 0, - 'comment' => 'youpi', - ); - - // Our event should be executed - $this->assertTrue($action->execute(new GenericEvent($event))); - - $comment = $c->getById(1); - $this->assertNotEmpty($comment); - $this->assertEquals(1, $comment['task_id']); - $this->assertEquals(0, $comment['user_id']); - $this->assertEquals('youpi', $comment['comment']); - } -} diff --git a/app/Action/CommentCreation.php b/app/Action/CommentCreation.php index fb9f1172..5dfd1c89 100644 --- a/app/Action/CommentCreation.php +++ b/app/Action/CommentCreation.php @@ -25,6 +25,7 @@ class CommentCreation extends Base return array( GithubWebhook::EVENT_ISSUE_COMMENT, GithubWebhook::EVENT_COMMIT, + BitbucketWebhook::EVENT_ISSUE_COMMENT, BitbucketWebhook::EVENT_COMMIT, GitlabWebhook::EVENT_COMMIT, ); diff --git a/app/Action/TaskAssignUser.php b/app/Action/TaskAssignUser.php index cf2a9a4b..c28df9fb 100644 --- a/app/Action/TaskAssignUser.php +++ b/app/Action/TaskAssignUser.php @@ -3,6 +3,7 @@ namespace Action; use Integration\GithubWebhook; +use Integration\BitbucketWebhook; /** * Assign a task to someone @@ -22,6 +23,7 @@ class TaskAssignUser extends Base { return array( GithubWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, + BitbucketWebhook::EVENT_ISSUE_ASSIGNEE_CHANGE, ); } diff --git a/app/Action/TaskClose.php b/app/Action/TaskClose.php index b7cd4dbf..0fe58dac 100644 --- a/app/Action/TaskClose.php +++ b/app/Action/TaskClose.php @@ -30,6 +30,7 @@ class TaskClose extends Base GitlabWebhook::EVENT_COMMIT, GitlabWebhook::EVENT_ISSUE_CLOSED, BitbucketWebhook::EVENT_COMMIT, + BitbucketWebhook::EVENT_ISSUE_CLOSED, ); } @@ -47,6 +48,7 @@ class TaskClose extends Base case GitlabWebhook::EVENT_COMMIT: case GitlabWebhook::EVENT_ISSUE_CLOSED: case BitbucketWebhook::EVENT_COMMIT: + case BitbucketWebhook::EVENT_ISSUE_CLOSED: return array(); default: return array('column_id' => t('Column')); @@ -67,6 +69,7 @@ class TaskClose extends Base case GitlabWebhook::EVENT_COMMIT: case GitlabWebhook::EVENT_ISSUE_CLOSED: case BitbucketWebhook::EVENT_COMMIT: + case BitbucketWebhook::EVENT_ISSUE_CLOSED: return array('task_id'); default: return array('task_id', 'column_id'); @@ -100,6 +103,7 @@ class TaskClose extends Base case GitlabWebhook::EVENT_COMMIT: case GitlabWebhook::EVENT_ISSUE_CLOSED: case BitbucketWebhook::EVENT_COMMIT: + case BitbucketWebhook::EVENT_ISSUE_CLOSED: return true; default: return $data['column_id'] == $this->getParam('column_id'); diff --git a/app/Action/TaskCreation.php b/app/Action/TaskCreation.php index 1c093eee..bb5b05c2 100644 --- a/app/Action/TaskCreation.php +++ b/app/Action/TaskCreation.php @@ -4,6 +4,7 @@ namespace Action; use Integration\GithubWebhook; use Integration\GitlabWebhook; +use Integration\BitbucketWebhook; /** * Create automatically a task from a webhook @@ -24,6 +25,7 @@ class TaskCreation extends Base return array( GithubWebhook::EVENT_ISSUE_OPENED, GitlabWebhook::EVENT_ISSUE_OPENED, + BitbucketWebhook::EVENT_ISSUE_OPENED, ); } diff --git a/app/Action/TaskOpen.php b/app/Action/TaskOpen.php index 73f1fad3..ee42ab32 100644 --- a/app/Action/TaskOpen.php +++ b/app/Action/TaskOpen.php @@ -3,6 +3,7 @@ namespace Action; use Integration\GithubWebhook; +use Integration\BitbucketWebhook; /** * Open automatically a task @@ -22,6 +23,7 @@ class TaskOpen extends Base { return array( GithubWebhook::EVENT_ISSUE_REOPENED, + BitbucketWebhook::EVENT_ISSUE_REOPENED, ); } |