Skip to content

Commit

Permalink
Add scenario to activerecord routing behavior.
Browse files Browse the repository at this point in the history
  • Loading branch information
petrabarus committed Jun 30, 2015
1 parent 1ebfcb4 commit 7a318b0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/Behaviors/ActiveRecordDeferredEventRoutingBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function routeEvent($event) {
}
$route = $handler[0];
unset($handler[0]);
$handler['scenario'] = $this->owner->getScenario();
$data = $handler;
$this->queue->post(new \UrbanIndo\Yii2\Queue\Job([
'route' => $route,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public function testEventRouting() {
$this->assertEquals(0, $queue->getQueueLength());
$this->assertEquals([
'id' => 5,
'scenario' => 'default',
], $job->data);
$model->trigger('eventTest2');
$this->assertEquals(1, $queue->getQueueLength());
Expand All @@ -35,7 +36,8 @@ public function testEventRouting() {
$this->assertFalse($job->isCallable());
$this->assertEquals(0, $queue->getQueueLength());
$this->assertEquals([
'halo' => 5
'halo' => 5,
'scenario' => 'default',
], $job->data);

}
Expand Down

0 comments on commit 7a318b0

Please sign in to comment.