Skip to content

Commit 3415bac

Browse files
committed
Merge remote-tracking branch 'upstream/8.x' into 8.x
2 parents d7b41f4 + bdc707f commit 3415bac

File tree

6 files changed

+19
-81
lines changed

6 files changed

+19
-81
lines changed

src/Illuminate/Auth/EloquentUserProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function retrieveById($identifier)
4949
$model = $this->createModel();
5050

5151
return $this->newModelQuery($model)
52-
->where($model->qualifyColumn($model->getAuthIdentifierName()), $identifier)
52+
->where($model->getAuthIdentifierName(), $identifier)
5353
->first();
5454
}
5555

@@ -65,7 +65,7 @@ public function retrieveByToken($identifier, $token)
6565
$model = $this->createModel();
6666

6767
$retrievedModel = $this->newModelQuery($model)->where(
68-
$model->qualifyColumn($model->getAuthIdentifierName()), $identifier
68+
$model->getAuthIdentifierName(), $identifier
6969
)->first();
7070

7171
if (! $retrievedModel) {

src/Illuminate/Cache/DynamoDbLock.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ public function __construct(DynamoDbStore $dynamo, $name, $seconds, $owner = nul
3434
*/
3535
public function acquire()
3636
{
37-
return $this->dynamo->add(
38-
$this->name, $this->owner, $this->seconds
39-
);
37+
if ($this->seconds > 0) {
38+
return $this->dynamo->add($this->name, $this->owner, $this->seconds);
39+
} else {
40+
return $this->dynamo->add($this->name, $this->owner, 86400);
41+
}
4042
}
4143

4244
/**

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 = '8.83.20';
36+
const VERSION = '8.83.23';
3737

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

src/Illuminate/Queue/SyncQueue.php

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@
1212

1313
class SyncQueue extends Queue implements QueueContract
1414
{
15-
protected $jobsCount = 0;
16-
1715
/**
1816
* Get the size of the queue.
1917
*
@@ -39,8 +37,6 @@ public function push($job, $data = '', $queue = null)
3937
{
4038
$queueJob = $this->resolveJob($this->createPayload($job, $queue, $data), $queue);
4139

42-
$this->jobsCount++;
43-
4440
try {
4541
$this->raiseBeforeJobEvent($queueJob);
4642

@@ -49,8 +45,6 @@ public function push($job, $data = '', $queue = null)
4945
$this->raiseAfterJobEvent($queueJob);
5046
} catch (Throwable $e) {
5147
$this->handleException($queueJob, $e);
52-
} finally {
53-
$this->jobsCount--;
5448
}
5549

5650
return 0;
@@ -119,19 +113,11 @@ protected function raiseExceptionOccurredJobEvent(Job $job, Throwable $e)
119113
*/
120114
protected function handleException(Job $queueJob, Throwable $e)
121115
{
122-
static $isGuarded = false;
123-
124-
if ($isGuarded) {
125-
$isGuarded = false;
126-
} else {
127-
$isGuarded = $this->jobsCount > 1;
116+
$this->raiseExceptionOccurredJobEvent($queueJob, $e);
128117

129-
$this->raiseExceptionOccurredJobEvent($queueJob, $e);
118+
$queueJob->fail($e);
130119

131-
$queueJob->fail($e);
132-
133-
throw $e;
134-
}
120+
throw $e;
135121
}
136122

137123
/**

tests/Auth/AuthEloquentUserProviderTest.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@ public function testRetrieveByIDReturnsUser()
2222
$mock = m::mock(stdClass::class);
2323
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
2424
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
25-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
26-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
25+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
2726
$mock->shouldReceive('first')->once()->andReturn('bar');
2827
$provider->expects($this->once())->method('createModel')->willReturn($mock);
2928
$user = $provider->retrieveById(1);
@@ -40,8 +39,7 @@ public function testRetrieveByTokenReturnsUser()
4039
$mock = m::mock(stdClass::class);
4140
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
4241
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
43-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
44-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
42+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
4543
$mock->shouldReceive('first')->once()->andReturn($mockUser);
4644
$provider->expects($this->once())->method('createModel')->willReturn($mock);
4745
$user = $provider->retrieveByToken(1, 'a');
@@ -55,8 +53,7 @@ public function testRetrieveTokenWithBadIdentifierReturnsNull()
5553
$mock = m::mock(stdClass::class);
5654
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
5755
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
58-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
59-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
56+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
6057
$mock->shouldReceive('first')->once()->andReturn(null);
6158
$provider->expects($this->once())->method('createModel')->willReturn($mock);
6259
$user = $provider->retrieveByToken(1, 'a');
@@ -81,8 +78,7 @@ public function testRetrieveByBadTokenReturnsNull()
8178
$mock = m::mock(stdClass::class);
8279
$mock->shouldReceive('newQuery')->once()->andReturn($mock);
8380
$mock->shouldReceive('getAuthIdentifierName')->once()->andReturn('id');
84-
$mock->shouldReceive('qualifyColumn')->with('id')->andReturn('users.id');
85-
$mock->shouldReceive('where')->once()->with('users.id', 1)->andReturn($mock);
81+
$mock->shouldReceive('where')->once()->with('id', 1)->andReturn($mock);
8682
$mock->shouldReceive('first')->once()->andReturn($mockUser);
8783
$provider->expects($this->once())->method('createModel')->willReturn($mock);
8884
$user = $provider->retrieveByToken(1, 'a');

tests/Integration/Queue/JobChainingTest.php

Lines changed: 4 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class JobChainingTest extends TestCase
1414
{
15-
public static $catchCallbackCount = 0;
15+
public static $catchCallbackRan = false;
1616

1717
protected function getEnvironmentSetUp($app)
1818
{
@@ -30,6 +30,7 @@ protected function tearDown(): void
3030
JobChainingTestFirstJob::$ran = false;
3131
JobChainingTestSecondJob::$ran = false;
3232
JobChainingTestThirdJob::$ran = false;
33+
static::$catchCallbackRan = false;
3334
}
3435

3536
public function testJobsCanBeChainedOnSuccess()
@@ -147,56 +148,19 @@ public function testThirdJobIsNotFiredIfSecondFails()
147148

148149
public function testCatchCallbackIsCalledOnFailure()
149150
{
150-
self::$catchCallbackCount = 0;
151-
152151
Bus::chain([
153152
new JobChainingTestFirstJob,
154153
new JobChainingTestFailingJob,
155154
new JobChainingTestSecondJob,
156155
])->catch(static function () {
157-
self::$catchCallbackCount++;
156+
self::$catchCallbackRan = true;
158157
})->dispatch();
159158

160159
$this->assertTrue(JobChainingTestFirstJob::$ran);
161-
$this->assertSame(1, static::$catchCallbackCount);
160+
$this->assertTrue(static::$catchCallbackRan);
162161
$this->assertFalse(JobChainingTestSecondJob::$ran);
163162
}
164163

165-
public function testCatchCallbackIsCalledOnceOnSyncQueue()
166-
{
167-
self::$catchCallbackCount = 0;
168-
169-
try {
170-
Bus::chain([
171-
new JobChainingTestFirstJob(),
172-
new JobChainingTestThrowJob(),
173-
new JobChainingTestSecondJob(),
174-
])->catch(function () {
175-
self::$catchCallbackCount++;
176-
})->onConnection('sync')->dispatch();
177-
} finally {
178-
$this->assertTrue(JobChainingTestFirstJob::$ran);
179-
$this->assertSame(1, static::$catchCallbackCount);
180-
$this->assertFalse(JobChainingTestSecondJob::$ran);
181-
}
182-
183-
self::$catchCallbackCount = 0;
184-
185-
try {
186-
Bus::chain([
187-
new JobChainingTestFirstJob(),
188-
new JobChainingTestThrowJob(),
189-
new JobChainingTestSecondJob(),
190-
])->catch(function () {
191-
self::$catchCallbackCount++;
192-
})->onConnection('sync')->dispatch();
193-
} finally {
194-
$this->assertTrue(JobChainingTestFirstJob::$ran);
195-
$this->assertSame(1, static::$catchCallbackCount);
196-
$this->assertFalse(JobChainingTestSecondJob::$ran);
197-
}
198-
}
199-
200164
public function testChainJobsUseSameConfig()
201165
{
202166
JobChainingTestFirstJob::dispatch()->allOnQueue('some_queue')->allOnConnection('sync1')->chain([
@@ -329,13 +293,3 @@ public function handle()
329293
$this->fail();
330294
}
331295
}
332-
333-
class JobChainingTestThrowJob implements ShouldQueue
334-
{
335-
use Dispatchable, InteractsWithQueue, Queueable;
336-
337-
public function handle()
338-
{
339-
throw new \Exception();
340-
}
341-
}

0 commit comments

Comments
 (0)