diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-12-04 18:43:53 -0500 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-12-04 18:43:53 -0500 |
commit | 6d2bd7383a8204a85429a88eb7ebe2a36a035455 (patch) | |
tree | ea398803446138859a700892e68a43cdc1bd3f59 | |
parent | 3384ba49fa06c06794665407f22553b3ae0de498 (diff) |
Make sure user mention events are serialized before to push in queue
-rw-r--r-- | app/Job/UserMentionJob.php | 7 | ||||
-rw-r--r-- | tests/units/Job/UserMentionJobTest.php | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/app/Job/UserMentionJob.php b/app/Job/UserMentionJob.php index ebb69094..bbb27131 100644 --- a/app/Job/UserMentionJob.php +++ b/app/Job/UserMentionJob.php @@ -23,7 +23,7 @@ class UserMentionJob extends BaseJob */ public function withParams($text, $eventName, GenericEvent $event) { - $this->jobParams = array($text, $eventName, $event); + $this->jobParams = array($text, $eventName, $event->getAll()); return $this; } @@ -32,10 +32,11 @@ class UserMentionJob extends BaseJob * * @param string $text * @param string $eventName - * @param GenericEvent $event + * @param array $eventData */ - public function execute($text, $eventName, GenericEvent $event) + public function execute($text, $eventName, array $eventData) { + $event = new GenericEvent($eventData); $users = $this->getMentionedUsers($text); foreach ($users as $user) { diff --git a/tests/units/Job/UserMentionJobTest.php b/tests/units/Job/UserMentionJobTest.php index 31d0ddbb..4cd4ac9b 100644 --- a/tests/units/Job/UserMentionJobTest.php +++ b/tests/units/Job/UserMentionJobTest.php @@ -90,7 +90,7 @@ class UserMentionJobTest extends Base $this->container['dispatcher']->addListener(TaskModel::EVENT_USER_MENTION, array($this, 'onUserMention')); - $userMentionJob->execute('test @user1 @user2', TaskModel::EVENT_USER_MENTION, $event); + $userMentionJob->execute('test @user1 @user2', TaskModel::EVENT_USER_MENTION, $event->getAll()); $called = $this->container['dispatcher']->getCalledListeners(); $this->assertArrayHasKey(TaskModel::EVENT_USER_MENTION.'.UserMentionJobTest::onUserMention', $called); |