Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 378f0f6

Browse files
committed
Fix tests.
1 parent 10c8798 commit 378f0f6

6 files changed

Lines changed: 14 additions & 12 deletions

File tree

src/Illuminate/Queue/BeanstalkdQueue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ public function push($job, $data = '', $queue = null)
5555
* @param string $job
5656
* @param mixed $data
5757
* @param string $queue
58-
* @return void
58+
* @return mixed
5959
*/
6060
public function later($delay, $job, $data = '', $queue = null)
6161
{
6262
$payload = $this->createPayload($job, $data);
6363

6464
$pheanstalk = $this->pheanstalk->useTube($this->getQueue($queue));
6565

66-
$pheanstalk->put($payload, Pheanstalk::DEFAULT_PRIORITY, $delay);
66+
return $pheanstalk->put($payload, Pheanstalk::DEFAULT_PRIORITY, $delay);
6767
}
6868

6969
/**

src/Illuminate/Queue/IronQueue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ public function push($job, $data = '', $queue = null)
7575
* @param string $job
7676
* @param mixed $data
7777
* @param string $queue
78-
* @return void
78+
* @return mixed
7979
*/
8080
public function later($delay, $job, $data = '', $queue = null)
8181
{
8282
$payload = $this->createPayload($job, $data);
8383

84-
$this->iron->postMessage($this->getQueue($queue), $payload, compact('delay'));
84+
return $this->iron->postMessage($this->getQueue($queue), $payload, compact('delay'))->id;
8585
}
8686

8787
/**

src/Illuminate/Queue/QueueInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public function push($job, $data = '', $queue = null);
1919
* @param string $job
2020
* @param mixed $data
2121
* @param string $queue
22-
* @return void
22+
* @return mixed
2323
*/
2424
public function later($delay, $job, $data = '', $queue = null);
2525

src/Illuminate/Queue/SqsQueue.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public function push($job, $data = '', $queue = null)
5656
* @param string $job
5757
* @param mixed $data
5858
* @param string $queue
59-
* @return void
59+
* @return mixed
6060
*/
6161
public function later($delay, $job, $data = '', $queue = null)
6262
{
@@ -66,7 +66,7 @@ public function later($delay, $job, $data = '', $queue = null)
6666

6767
'QueueUrl' => $this->getQueue($queue), 'MessageBody' => $payload, 'DelaySeconds' => $delay,
6868

69-
));
69+
))->MessageId;
7070
}
7171

7272
/**

src/Illuminate/Queue/SyncQueue.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@ class SyncQueue extends Queue implements QueueInterface {
88
* @param string $job
99
* @param mixed $data
1010
* @param string $queue
11-
* @return void
11+
* @return mixed
1212
*/
1313
public function push($job, $data = '', $queue = null)
1414
{
1515
$this->resolveJob($job, $data)->fire();
16+
17+
return 0;
1618
}
1719

1820
/**
@@ -22,7 +24,7 @@ public function push($job, $data = '', $queue = null)
2224
* @param string $job
2325
* @param mixed $data
2426
* @param string $queue
25-
* @return void
27+
* @return mixed
2628
*/
2729
public function later($delay, $job, $data = '', $queue = null)
2830
{

tests/Queue/QueueIronQueueTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function testPushProperlyPushesJobOntoIron()
1414
{
1515
$queue = new Illuminate\Queue\IronQueue($iron = m::mock('IronMQ'), $crypt = m::mock('Illuminate\Encryption\Encrypter'), m::mock('Illuminate\Http\Request'), 'default');
1616
$crypt->shouldReceive('encrypt')->once()->with(json_encode(array('job' => 'foo', 'data' => array(1, 2, 3))))->andReturn('encrypted');
17-
$iron->shouldReceive('postMessage')->once()->with('default', 'encrypted');
17+
$iron->shouldReceive('postMessage')->once()->with('default', 'encrypted')->andReturn((object) array('id' => 1));
1818
$queue->push('foo', array(1, 2, 3));
1919
}
2020

@@ -25,7 +25,7 @@ public function testPushProperlyPushesJobOntoIronWithClosures()
2525
$name = 'Foo';
2626
$closure = new Illuminate\Support\SerializableClosure($innerClosure = function() use ($name) { return $name; });
2727
$crypt->shouldReceive('encrypt')->once()->with(json_encode(array('job' => 'IlluminateQueueClosure', 'data' => array('closure' => serialize($closure)))))->andReturn('encrypted');
28-
$iron->shouldReceive('postMessage')->once()->with('default', 'encrypted');
28+
$iron->shouldReceive('postMessage')->once()->with('default', 'encrypted')->andReturn((object) array('id' => 1));
2929
$queue->push($innerClosure);
3030
}
3131

@@ -34,7 +34,7 @@ public function testDelayedPushProperlyPushesJobOntoIron()
3434
{
3535
$queue = new Illuminate\Queue\IronQueue($iron = m::mock('IronMQ'), $crypt = m::mock('Illuminate\Encryption\Encrypter'), m::mock('Illuminate\Http\Request'), 'default');
3636
$crypt->shouldReceive('encrypt')->once()->with(json_encode(array('job' => 'foo', 'data' => array(1, 2, 3))))->andReturn('encrypted');
37-
$iron->shouldReceive('postMessage')->once()->with('default', 'encrypted', array('delay' => 5));
37+
$iron->shouldReceive('postMessage')->once()->with('default', 'encrypted', array('delay' => 5))->andReturn((object) array('id' => 1));
3838
$queue->later(5, 'foo', array(1, 2, 3));
3939
}
4040

0 commit comments

Comments
 (0)