Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 29a0924

Browse files
authored
Add Laravel 10 support (#5)
* Update composer.json * Laravel 10 upgrades * Update composer.json
1 parent 148206b commit 29a0924

File tree

3 files changed

+21
-46
lines changed

3 files changed

+21
-46
lines changed

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
"require": {
2020
"php": ">=8.0",
2121
"aws/aws-sdk-php": "^3.189.0",
22-
"league/flysystem": "^3.0",
23-
"illuminate/container": "^9.0.0",
24-
"illuminate/contracts": "^9.0.0",
25-
"illuminate/filesystem": "^9.0.0",
26-
"illuminate/queue": "^9.0.0",
27-
"illuminate/support": "^9.0.0"
22+
"league/flysystem": "~3",
23+
"illuminate/container": "~9|~10",
24+
"illuminate/contracts": "~9|~10",
25+
"illuminate/filesystem": "~9|~10",
26+
"illuminate/queue": "~9|~10",
27+
"illuminate/support": "~9|~10"
2828
},
2929
"require-dev": {
3030
"mockery/mockery": "~1",
31-
"phpunit/phpunit": "~9",
31+
"phpunit/phpunit": "~10",
3232
"friendsofphp/php-cs-fixer": "^3.2"
3333
},
3434
"suggest": {

src/SqsDiskQueue.php

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
namespace SimpleSoftwareIO\SqsDisk;
44

55
use Aws\Sqs\SqsClient;
6+
use DateInterval;
7+
use DateTimeInterface;
8+
use Illuminate\Contracts\Queue\Job;
69
use Illuminate\Support\Arr;
710
use Illuminate\Queue\SqsQueue;
811

@@ -17,50 +20,22 @@ class SqsDiskQueue extends SqsQueue
1720
*/
1821
public const MAX_SQS_LENGTH = 250000;
1922

20-
/**
21-
* The Amazon SQS instance.
22-
*
23-
* @var \Aws\Sqs\SqsClient
24-
*/
25-
protected $sqs;
26-
27-
/**
28-
* The name of the default queue.
29-
*
30-
* @var string
31-
*/
32-
protected $default;
33-
3423
/**
3524
* The disk options to save large payloads.
3625
*
3726
* @var array
3827
*/
39-
protected $diskOptions;
40-
41-
/**
42-
* The queue URL prefix.
43-
*
44-
* @var string
45-
*/
46-
protected $prefix;
47-
48-
/**
49-
* The queue name suffix.
50-
*
51-
* @var string
52-
*/
53-
private $suffix;
28+
protected array $diskOptions;
5429

5530
/**
5631
* Create a new Amazon SQS queue instance.
5732
*
58-
* @param \Aws\Sqs\SqsClient $sqs
33+
* @param SqsClient $sqs
5934
* @param string $default
6035
* @param array $diskOptions
6136
* @param string $prefix
6237
* @param string $suffix
63-
* @param bool $dispatchAfterCommit
38+
* @param bool $dispatchAfterCommit
6439
*
6540
* @return void
6641
*/
@@ -72,12 +47,9 @@ public function __construct(
7247
$suffix = '',
7348
$dispatchAfterCommit = false,
7449
) {
75-
$this->sqs = $sqs;
76-
$this->default = $default;
7750
$this->diskOptions = $diskOptions;
78-
$this->prefix = $prefix;
79-
$this->suffix = $suffix;
80-
$this->dispatchAfterCommit = $dispatchAfterCommit;
51+
52+
parent::__construct($sqs, $default, $prefix, $suffix, $dispatchAfterCommit);
8153
}
8254

8355
/**
@@ -115,7 +87,7 @@ public function pushRaw($payload, $queue = null, array $options = [], $delay = 0
11587
/**
11688
* Push a new job onto the queue after a delay.
11789
*
118-
* @param \DateTimeInterface|\DateInterval|int $delay
90+
* @param DateTimeInterface|DateInterval|int $delay
11991
* @param string $job
12092
* @param mixed $data
12193
* @param string|null $queue
@@ -140,7 +112,7 @@ function ($payload, $queue) use ($delay) {
140112
*
141113
* @param string|null $queue
142114
*
143-
* @return \Illuminate\Contracts\Queue\Job|null
115+
* @return Job|null
144116
*/
145117
public function pop($queue = null)
146118
{
@@ -162,7 +134,7 @@ public function pop($queue = null)
162134
}
163135

164136
/**
165-
* Delete all of the jobs from the queue.
137+
* Delete all the jobs from the queue.
166138
*
167139
* @param string $queue
168140
*

tests/SqsDiskJobTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ public function testItRemovesTheJobFromTheDiskIfCleanupIsEnabled()
3737
{
3838
$this->mockedFilesystemAdapter->shouldReceive('disk')
3939
->with('s3')
40+
->once()
4041
->andReturnSelf();
4142

4243
$this->mockedFilesystemAdapter->shouldReceive('delete')
4344
->with('prefix/e3cd03ee-59a3-4ad8-b0aa-ee2e3808ac81.json')
45+
->once()
4446
->andReturnSelf();
4547

4648
$this->mockedContainer->shouldReceive('make')
4749
->with('filesystem')
50+
->once()
4851
->andReturn($this->mockedFilesystemAdapter);
4952

5053
$this->mockedSqsClient->shouldReceive('deleteMessage');

0 commit comments

Comments
 (0)