forked from laravel/framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQueueSyncJobTest.php
More file actions
executable file
·46 lines (33 loc) · 1.25 KB
/
QueueSyncJobTest.php
File metadata and controls
executable file
·46 lines (33 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
use Mockery as m;
class QueueSyncJobTest extends PHPUnit_Framework_TestCase {
public function tearDown()
{
m::close();
}
public function testFireResolvesAndFiresJobClass()
{
$container = m::mock('Illuminate\Container\Container');
$job = new Illuminate\Queue\Jobs\SyncJob($container, 'Foo', '"data"');
$handler = m::mock('StdClass');
$container->shouldReceive('make')->once()->with('Foo')->andReturn($handler);
$handler->shouldReceive('fire')->once()->with($job, 'data');
$job->fire();
}
public function testClosuresCanBeFiredBySyncJob()
{
unset($_SERVER['__queue.closure']);
$job = new Illuminate\Queue\Jobs\SyncJob(new Illuminate\Container\Container, function() { $_SERVER['__queue.closure'] = true; }, 'data');
$job->fire();
$this->assertTrue($_SERVER['__queue.closure']);
}
public function testFireResolvesAndFiresJobClassWithCorrectMethod()
{
$container = m::mock('Illuminate\Container\Container');
$job = new Illuminate\Queue\Jobs\SyncJob($container, 'Foo@bar', '"data"');
$handler = m::mock('StdClass');
$container->shouldReceive('make')->once()->with('Foo')->andReturn($handler);
$handler->shouldReceive('bar')->once()->with($job, 'data');
$job->fire();
}
}