Skip to content

Commit 6fa69bf

Browse files
committed
version
2 parents 5d817be + 73f18a6 commit 6fa69bf

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Application extends Container implements ApplicationContract, CachesConfig
3333
*
3434
* @var string
3535
*/
36-
const VERSION = '7.12.0';
36+
const VERSION = '7.13.0';
3737

3838
/**
3939
* The base path for the Laravel installation.

tests/Queue/QueueWorkerTest.php

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,21 @@ public function testWorkerCanWorkUntilQueueIsEmpty()
5959
$secondJob = new WorkerFakeJob,
6060
]]);
6161

62-
$this->expectException(LoopBreakerException::class);
62+
try {
63+
$worker->daemon('default', 'queue', $workerOptions);
6364

64-
$worker->daemon('default', 'queue', $workerOptions);
65+
$this->fail('Expected LoopBreakerException to be thrown.');
66+
} catch (LoopBreakerException $e) {
67+
$this->assertTrue($firstJob->fired);
6568

66-
$this->assertTrue($firstJob->fired);
69+
$this->assertTrue($secondJob->fired);
6770

68-
$this->assertTrue($secondJob->fired);
71+
$this->assertSame(0, $worker->stoppedWithStatus);
6972

70-
$this->assertSame(0, $worker->stoppedWithStatus);
73+
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->twice();
7174

72-
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessing::class))->twice();
73-
74-
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessed::class))->twice();
75+
$this->events->shouldHaveReceived('dispatch')->with(m::type(JobProcessed::class))->twice();
76+
}
7577
}
7678

7779
public function testJobCanBeFiredBasedOnPriority()
@@ -276,21 +278,23 @@ public function testJobRunsIfAppIsNotInMaintenanceMode()
276278

277279
$maintenanceModeChecker = function () {
278280
if ($this->maintenanceFlags) {
279-
return array_pop($this->maintenanceFlags);
281+
return array_shift($this->maintenanceFlags);
280282
}
281283

282284
throw new LoopBreakerException;
283285
};
284286

285-
$this->expectException(LoopBreakerException::class);
286-
287287
$worker = $this->getWorker('default', ['queue' => [$firstJob, $secondJob]], $maintenanceModeChecker);
288288

289-
$worker->daemon('default', 'queue', $this->workerOptions());
289+
try {
290+
$worker->daemon('default', 'queue', $this->workerOptions());
290291

291-
$this->assertEquals($firstJob->attempts, 1);
292+
$this->fail('Expected LoopBreakerException to be thrown');
293+
} catch (LoopBreakerException $e) {
294+
$this->assertSame(1, $firstJob->attempts);
292295

293-
$this->assertEquals($firstJob->attempts, 0);
296+
$this->assertSame(0, $secondJob->attempts);
297+
}
294298
}
295299

296300
public function testJobDoesNotFireIfDeleted()
@@ -349,6 +353,7 @@ private function workerOptions(array $overrides = [])
349353
class InsomniacWorker extends Worker
350354
{
351355
public $sleptFor;
356+
public $stopOnMemoryExceeded = false;
352357

353358
public function sleep($seconds)
354359
{
@@ -366,6 +371,11 @@ public function daemonShouldRun(WorkerOptions $options, $connectionName, $queue)
366371
{
367372
return ! ($this->isDownForMaintenance)();
368373
}
374+
375+
public function memoryExceeded($memoryLimit)
376+
{
377+
return $this->stopOnMemoryExceeded;
378+
}
369379
}
370380

371381
class WorkerFakeManager extends QueueManager

0 commit comments

Comments
 (0)