|
4 | 4 |
|
5 | 5 | use Carbon\Carbon; |
6 | 6 | use LukeWaite\LaravelQueueAwsBatch\Exceptions\UnsupportedException; |
| 7 | +use LukeWaite\LaravelQueueAwsBatch\Queues\BatchQueue; |
7 | 8 | use Mockery\Adapter\Phpunit\MockeryTestCase as TestCase; |
8 | 9 | use Mockery as m; |
| 10 | +use Mockery\MockInterface; |
9 | 11 |
|
10 | 12 | class BatchQueueTest extends TestCase |
11 | 13 | { |
12 | | - public function setUp(): void |
| 14 | + protected MockInterface $database; |
| 15 | + |
| 16 | + protected MockInterface $batch; |
| 17 | + |
| 18 | + protected BatchQueue $queue; |
| 19 | + |
| 20 | + protected function setUp(): void |
13 | 21 | { |
14 | | - $this->queue = $this->getMockBuilder('LukeWaite\LaravelQueueAwsBatch\Queues\BatchQueue')->setMethods(null)->setConstructorArgs([ |
15 | | - $this->database = m::mock('Illuminate\Database\Connection'), |
| 22 | + parent::setUp(); |
| 23 | + |
| 24 | + $this->database = m::mock('Illuminate\Database\Connection'); |
| 25 | + $this->batch = m::mock('Aws\Batch\BatchClient'); |
| 26 | + |
| 27 | + $this->queue = new BatchQueue( |
| 28 | + $this->database, |
16 | 29 | 'table', |
17 | 30 | 'default', |
18 | 31 | '60', |
19 | 32 | 'jobdefinition', |
20 | | - $this->batch = m::mock('Aws\Batch\BatchClient'), |
21 | | - ])->getMock(); |
| 33 | + $this->batch, |
| 34 | + ); |
22 | 35 |
|
23 | | - $this->queue->setContainer(m::mock('Illuminate\Container\Container')); |
| 36 | + $this->queue->setContainer(new \Illuminate\Container\Container()); |
24 | 37 | } |
25 | 38 |
|
26 | 39 | public function testPushProperlyPushesJobOntoDatabase() |
@@ -84,7 +97,7 @@ public function testGetJobById() |
84 | 97 |
|
85 | 98 | $this->database->shouldReceive('commit')->once(); |
86 | 99 |
|
87 | | - $this->queue->getJobById(1, 'default'); |
| 100 | + $this->queue->getJobById(1); |
88 | 101 |
|
89 | 102 | Carbon::setTestNow(); |
90 | 103 | } |
|
0 commit comments