From 490bcd17d8f797b948c4e90d6b67bf3695143bb0 Mon Sep 17 00:00:00 2001 From: Timo Date: Sun, 5 Apr 2020 23:50:11 +0200 Subject: [PATCH] Add new event subtask.create_update --- app/Core/Event/EventManager.php | 2 ++ app/Job/SubtaskEventJob.php | 22 ++++++++++++---------- app/Locale/bs_BA/translations.php | 1 + app/Locale/ca_ES/translations.php | 1 + app/Locale/cs_CZ/translations.php | 1 + app/Locale/da_DK/translations.php | 1 + app/Locale/de_DE/translations.php | 10 ++++++---- app/Locale/el_GR/translations.php | 1 + app/Locale/es_ES/translations.php | 1 + app/Locale/es_VE/translations.php | 1 + app/Locale/fa_IR/translations.php | 1 + app/Locale/fi_FI/translations.php | 1 + app/Locale/fr_FR/translations.php | 1 + app/Locale/hr_HR/translations.php | 1 + app/Locale/hu_HU/translations.php | 1 + app/Locale/id_ID/translations.php | 1 + app/Locale/it_IT/translations.php | 1 + app/Locale/ja_JP/translations.php | 1 + app/Locale/ko_KR/translations.php | 1 + app/Locale/my_MY/translations.php | 1 + app/Locale/nb_NO/translations.php | 1 + app/Locale/nl_NL/translations.php | 1 + app/Locale/pl_PL/translations.php | 1 + app/Locale/pt_BR/translations.php | 1 + app/Locale/pt_PT/translations.php | 1 + app/Locale/ro_RO/translations.php | 1 + app/Locale/ru_RU/translations.php | 3 +++ app/Locale/sk_SK/translations.php | 1 + app/Locale/sr_Latn_RS/translations.php | 1 + app/Locale/sv_SE/translations.php | 1 + app/Locale/th_TH/translations.php | 1 + app/Locale/tr_TR/translations.php | 1 + app/Locale/uk_UA/translations.php | 1 + app/Locale/vi_VN/translations.php | 1 + app/Locale/zh_CN/translations.php | 1 + app/Locale/zh_TW/translations.php | 1 + app/Model/SubtaskModel.php | 20 ++++++++++++++------ tests/units/Job/SubtaskEventJobTest.php | 8 +++++--- 38 files changed, 74 insertions(+), 23 deletions(-) diff --git a/app/Core/Event/EventManager.php b/app/Core/Event/EventManager.php index 48a9d2991..75e81989f 100644 --- a/app/Core/Event/EventManager.php +++ b/app/Core/Event/EventManager.php @@ -3,6 +3,7 @@ namespace Kanboard\Core\Event; use Kanboard\Model\TaskModel; +use Kanboard\Model\SubtaskModel; use Kanboard\Model\TaskLinkModel; /** @@ -54,6 +55,7 @@ class EventManager TaskModel::EVENT_ASSIGNEE_CHANGE => t('Task assignee change'), TaskModel::EVENT_DAILY_CRONJOB => t('Daily background job for tasks'), TaskModel::EVENT_MOVE_SWIMLANE => t('Move a task to another swimlane'), + SubtaskModel::EVENT_CREATE_UPDATE => t('Subtask creation or modification'), ); $events = array_merge($events, $this->events); diff --git a/app/Job/SubtaskEventJob.php b/app/Job/SubtaskEventJob.php index 36d268dd8..3fddc53cb 100644 --- a/app/Job/SubtaskEventJob.php +++ b/app/Job/SubtaskEventJob.php @@ -15,25 +15,25 @@ class SubtaskEventJob extends BaseJob /** * Set job params * - * @param int $subtaskId - * @param string $eventName - * @param array $values + * @param int $subtaskId + * @param array $eventNames + * @param array $values * @return $this */ - public function withParams($subtaskId, $eventName, array $values = array()) + public function withParams($subtaskId, array $eventNames, array $values = array()) { - $this->jobParams = array($subtaskId, $eventName, $values); + $this->jobParams = array($subtaskId, $eventNames, $values); return $this; } /** * Execute job * - * @param int $subtaskId - * @param string $eventName - * @param array $values + * @param int $subtaskId + * @param array $eventNames + * @param array $values */ - public function execute($subtaskId, $eventName, array $values = array()) + public function execute($subtaskId, array $eventNames, array $values = array()) { $event = SubtaskEventBuilder::getInstance($this->container) ->withSubtaskId($subtaskId) @@ -41,7 +41,9 @@ class SubtaskEventJob extends BaseJob ->buildEvent(); if ($event !== null) { - $this->dispatcher->dispatch($eventName, $event); + foreach ($eventNames as $eventName) { + $this->dispatcher->dispatch($eventName, $event); + } } } } diff --git a/app/Locale/bs_BA/translations.php b/app/Locale/bs_BA/translations.php index 2f7ae67d8..274d73a82 100644 --- a/app/Locale/bs_BA/translations.php +++ b/app/Locale/bs_BA/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/ca_ES/translations.php b/app/Locale/ca_ES/translations.php index 2aab55e80..92f0998a7 100644 --- a/app/Locale/ca_ES/translations.php +++ b/app/Locale/ca_ES/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/cs_CZ/translations.php b/app/Locale/cs_CZ/translations.php index f44d6c87d..19bba733c 100644 --- a/app/Locale/cs_CZ/translations.php +++ b/app/Locale/cs_CZ/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 34c5b31c8..bcee51d79 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index ddf75fc79..2977c5ae9 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -1409,14 +1409,16 @@ return array( 'XBT - bitcoin' => 'XBT - Bitcoin', 'Assigned' => 'Zugeordnet', 'Task limits apply to each swimlane individually' => 'Aufgabenlimit gilt pro Swimlane', - // 'Column task limits apply to each swimlane individually' => '', - // 'Column task limits are applied to each swimlane individually' => '', - // 'Column task limits are applied across swimlanes' => '', - // 'Task limit: ' => '', + 'Column task limits apply to each swimlane individually' => 'Spaltenaufgabenlimit für jede Swimlane einzeln anwenden', + 'Column task limits are applied to each swimlane individually' => 'Spaltenaufgabenlimit wird für jede Swimlane einzeln angewendet', + 'Column task limits are applied across swimlanes' => 'Spaltenaufgabenlimit wird swimlaneübergreifend angewendet', + 'Task limit: ' => 'Aufgabenlimit', 'Change to global tag' => 'Zu globalem Schlagwort machen', 'Do you really want to make the tag "%s" global?' => 'Das Schlagwort "%s" wirklich global machen?', 'Enable global tags for this project' => 'Globale Schlagworte für dieses Projekt aktivieren', 'Group membership(s):' => 'Gruppen-Mitgliedschaft(en):', '%s is a member of the following group(s): %s' => '%s ist Mitglied in der/den folgenden Gruppe(n): %s', // '%d/%d group(s) shown' => '', + 'Group membership(s):' => 'Gruppen Mitgliedschaft(en)', + 'Subtask creation or modification' => 'Teilaufgabe erstellen oder ändern', ); diff --git a/app/Locale/el_GR/translations.php b/app/Locale/el_GR/translations.php index 7105b66cd..a1bba9bd1 100644 --- a/app/Locale/el_GR/translations.php +++ b/app/Locale/el_GR/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index 51c855143..221974e75 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/es_VE/translations.php b/app/Locale/es_VE/translations.php index a4d66eb73..a5755909c 100644 --- a/app/Locale/es_VE/translations.php +++ b/app/Locale/es_VE/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/fa_IR/translations.php b/app/Locale/fa_IR/translations.php index 8e98637bb..a66d2da1a 100644 --- a/app/Locale/fa_IR/translations.php +++ b/app/Locale/fa_IR/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index c9401a96a..84680c62f 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index b604cc3fc..be153214a 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -1419,4 +1419,5 @@ return array( 'Group membership(s):' => 'Membre des groupes :', '%s is a member of the following group(s): %s' => '%s est membre des groupes suivants: %s', '%d/%d group(s) shown' => '%d/%d groupe(s) affiché(s)', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/hr_HR/translations.php b/app/Locale/hr_HR/translations.php index bfbaf3f60..eacb29241 100644 --- a/app/Locale/hr_HR/translations.php +++ b/app/Locale/hr_HR/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/hu_HU/translations.php b/app/Locale/hu_HU/translations.php index 2a58098e1..025066ff8 100644 --- a/app/Locale/hu_HU/translations.php +++ b/app/Locale/hu_HU/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/id_ID/translations.php b/app/Locale/id_ID/translations.php index 8e0055dbf..67e913605 100644 --- a/app/Locale/id_ID/translations.php +++ b/app/Locale/id_ID/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 57dccdded..8902f02fa 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 7963dd5ad..4e2f9fb04 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/ko_KR/translations.php b/app/Locale/ko_KR/translations.php index c1ba6ef7f..ef99ebc8e 100644 --- a/app/Locale/ko_KR/translations.php +++ b/app/Locale/ko_KR/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/my_MY/translations.php b/app/Locale/my_MY/translations.php index f22ec0d3e..0a6c84c67 100644 --- a/app/Locale/my_MY/translations.php +++ b/app/Locale/my_MY/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/nb_NO/translations.php b/app/Locale/nb_NO/translations.php index adb3deacb..66fab0e15 100644 --- a/app/Locale/nb_NO/translations.php +++ b/app/Locale/nb_NO/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/nl_NL/translations.php b/app/Locale/nl_NL/translations.php index 730276377..a030860a8 100644 --- a/app/Locale/nl_NL/translations.php +++ b/app/Locale/nl_NL/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index 152575555..34f61b365 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 7ae1f72ee..5cfa1592e 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/pt_PT/translations.php b/app/Locale/pt_PT/translations.php index b1c7c4229..1cf4a7631 100644 --- a/app/Locale/pt_PT/translations.php +++ b/app/Locale/pt_PT/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/ro_RO/translations.php b/app/Locale/ro_RO/translations.php index f8e6a6db4..b1e9b5885 100644 --- a/app/Locale/ro_RO/translations.php +++ b/app/Locale/ro_RO/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 88e74dc1e..47c634aa0 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -1419,4 +1419,7 @@ return array( 'Group membership(s):' => 'Состоит в группах:', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Enable global tags for this project' => '', + // 'Group membership(s):' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/sk_SK/translations.php b/app/Locale/sk_SK/translations.php index b8431c37e..40844802f 100644 --- a/app/Locale/sk_SK/translations.php +++ b/app/Locale/sk_SK/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/sr_Latn_RS/translations.php b/app/Locale/sr_Latn_RS/translations.php index cc1c70dea..3ae3cc3ed 100644 --- a/app/Locale/sr_Latn_RS/translations.php +++ b/app/Locale/sr_Latn_RS/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index fe70b7ab5..4579f0167 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index b7c44f343..611f42239 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/tr_TR/translations.php b/app/Locale/tr_TR/translations.php index 91f1cbd80..430868ff0 100644 --- a/app/Locale/tr_TR/translations.php +++ b/app/Locale/tr_TR/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/uk_UA/translations.php b/app/Locale/uk_UA/translations.php index 9b091fe83..effc0ff78 100644 --- a/app/Locale/uk_UA/translations.php +++ b/app/Locale/uk_UA/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/vi_VN/translations.php b/app/Locale/vi_VN/translations.php index 2cc370f61..91eb50368 100644 --- a/app/Locale/vi_VN/translations.php +++ b/app/Locale/vi_VN/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 1c247d78d..bf83ce92c 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Locale/zh_TW/translations.php b/app/Locale/zh_TW/translations.php index d28cd8d66..16f23991b 100644 --- a/app/Locale/zh_TW/translations.php +++ b/app/Locale/zh_TW/translations.php @@ -1419,4 +1419,5 @@ return array( // 'Group membership(s):' => '', // '%s is a member of the following group(s): %s' => '', // '%d/%d group(s) shown' => '', + // 'Subtask creation or modification' => '', ); diff --git a/app/Model/SubtaskModel.php b/app/Model/SubtaskModel.php index 626ccbefd..f02ac232f 100644 --- a/app/Model/SubtaskModel.php +++ b/app/Model/SubtaskModel.php @@ -34,9 +34,10 @@ class SubtaskModel extends Base * * @var string */ - const EVENT_UPDATE = 'subtask.update'; - const EVENT_CREATE = 'subtask.create'; - const EVENT_DELETE = 'subtask.delete'; + const EVENT_UPDATE = 'subtask.update'; + const EVENT_CREATE = 'subtask.create'; + const EVENT_DELETE = 'subtask.delete'; + const EVENT_CREATE_UPDATE = 'subtask.create_update'; /** * Get projectId from subtaskId @@ -216,7 +217,10 @@ class SubtaskModel extends Base if ($subtaskId !== false) { $this->subtaskTimeTrackingModel->updateTaskTimeTracking($values['task_id']); - $this->queueManager->push($this->subtaskEventJob->withParams($subtaskId, self::EVENT_CREATE)); + $this->queueManager->push($this->subtaskEventJob->withParams( + $subtaskId, + array(self::EVENT_CREATE_UPDATE, self::EVENT_CREATE) + )); } return $subtaskId; @@ -240,7 +244,11 @@ class SubtaskModel extends Base $this->subtaskTimeTrackingModel->updateTaskTimeTracking($subtask['task_id']); if ($fireEvent) { - $this->queueManager->push($this->subtaskEventJob->withParams($subtask['id'], self::EVENT_UPDATE, $values)); + $this->queueManager->push($this->subtaskEventJob->withParams( + $subtask['id'], + array(self::EVENT_CREATE_UPDATE, self::EVENT_UPDATE), + $values + )); } } @@ -256,7 +264,7 @@ class SubtaskModel extends Base */ public function remove($subtaskId) { - $this->subtaskEventJob->execute($subtaskId, self::EVENT_DELETE); + $this->subtaskEventJob->execute($subtaskId, array(self::EVENT_DELETE)); return $this->db->table(self::TABLE)->eq('id', $subtaskId)->remove(); } diff --git a/tests/units/Job/SubtaskEventJobTest.php b/tests/units/Job/SubtaskEventJobTest.php index bdc30b519..32bcd3720 100644 --- a/tests/units/Job/SubtaskEventJobTest.php +++ b/tests/units/Job/SubtaskEventJobTest.php @@ -12,9 +12,9 @@ class SubtaskEventJobTest extends Base public function testJobParams() { $subtaskEventJob = new SubtaskEventJob($this->container); - $subtaskEventJob->withParams(123, 'foobar', array('k' => 'v')); + $subtaskEventJob->withParams(123, array('foobar'), array('k' => 'v')); - $this->assertSame(array(123, 'foobar', array('k' => 'v')), $subtaskEventJob->getJobParams()); + $this->assertSame(array(123, array('foobar'), array('k' => 'v')), $subtaskEventJob->getJobParams()); } public function testWithMissingSubtask() @@ -22,7 +22,7 @@ class SubtaskEventJobTest extends Base $this->container['dispatcher']->addListener(SubtaskModel::EVENT_CREATE, function() {}); $subtaskEventJob = new SubtaskEventJob($this->container); - $subtaskEventJob->execute(42, SubtaskModel::EVENT_CREATE); + $subtaskEventJob->execute(42, array(SubtaskModel::EVENT_CREATE)); $called = $this->container['dispatcher']->getCalledListeners(); $this->assertEmpty($called); @@ -33,6 +33,7 @@ class SubtaskEventJobTest extends Base $this->container['dispatcher']->addListener(SubtaskModel::EVENT_CREATE, function() {}); $this->container['dispatcher']->addListener(SubtaskModel::EVENT_UPDATE, function() {}); $this->container['dispatcher']->addListener(SubtaskModel::EVENT_DELETE, function() {}); + $this->container['dispatcher']->addListener(SubtaskModel::EVENT_CREATE_UPDATE, function() {}); $subtaskModel = new SubtaskModel($this->container); $taskCreationModel = new TaskCreationModel($this->container); @@ -48,5 +49,6 @@ class SubtaskEventJobTest extends Base $this->assertArrayHasKey(SubtaskModel::EVENT_CREATE.'.closure', $called); $this->assertArrayHasKey(SubtaskModel::EVENT_UPDATE.'.closure', $called); $this->assertArrayHasKey(SubtaskModel::EVENT_DELETE.'.closure', $called); + $this->assertArrayHasKey(SubtaskModel::EVENT_CREATE_UPDATE.'.closure', $called); } }