Skip to content

Commit 4a7072a

Browse files
Add support for Laravel 9 (#51)
* Add support for Laravel 9 * Fixes incorrect class property type in docblock * Fixes deprecated warning message in PHP 8.1 * Initialize github action config * Apply fixes from StyleCI
1 parent f1b893b commit 4a7072a

File tree

4 files changed

+52
-11
lines changed

4 files changed

+52
-11
lines changed

.github/workflows/main.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
paths-ignore: ['*.md']
6+
pull_request:
7+
branches: [master]
8+
paths-ignore: ['*.md']
9+
10+
jobs:
11+
test:
12+
name: Test (PHP ${{ matrix.php }})
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
php: [7.4, 8.0, 8.1]
17+
steps:
18+
- uses: actions/checkout@v1
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: ${{ matrix.php }}
23+
extensions: json
24+
- name: Cache composer dependencies
25+
uses: actions/cache@v2
26+
env:
27+
cache-name: laravel-pubsub-queue
28+
with:
29+
path: ~/.composer
30+
key: php-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.json') }}
31+
restore-keys: |
32+
php-${{ matrix.php }}-build-${{ env.cache-name }}-
33+
php-${{ matrix.php }}-build-
34+
php-${{ matrix.php }}-
35+
- name: Install composer dependencies
36+
run: composer install --prefer-dist
37+
- name: Run the test suite
38+
run: phpdbg -qrr -dmemory_limit=-1 vendor/bin/phpunit --coverage-text

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
"require": {
2121
"php" : ">=7.2",
2222
"ext-json": "*",
23-
"illuminate/queue": "5.7.* | 5.8.* | ^6.0 | ^7.0 | ^8.0",
24-
"illuminate/support": "5.7.* | 5.8.* | ^6.0 | ^7.0 | ^8.0",
23+
"illuminate/queue": "5.7.* | 5.8.* | ^6.0 | ^7.0 | ^8.0 | ^9.0",
24+
"illuminate/support": "5.7.* | 5.8.* | ^6.0 | ^7.0 | ^8.0 | ^9.0",
2525
"google/cloud-pubsub": "^1.1",
2626
"ramsey/uuid": "^2.0|^3.0|^4.0"
2727
},

src/Jobs/PubSubJob.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,18 @@ class PubSubJob extends Job implements JobContract
2020
/**
2121
* The job instance.
2222
*
23-
* @var array
23+
* @var Message
2424
*/
2525
protected $job;
2626

2727
/**
2828
* Create a new job instance.
2929
*
30-
* @param \Illuminate\Container\Container $container
31-
* @param \Kainxspirits\PubSubQueue\PubSubQueue $sqs
32-
* @param \Google\Cloud\PubSub\Message $job
33-
* @param string $connectionName
34-
* @param string $queue
30+
* @param \Illuminate\Container\Container $container
31+
* @param \Kainxspirits\PubSubQueue\PubSubQueue $sqs
32+
* @param \Google\Cloud\PubSub\Message $job
33+
* @param string $connectionName
34+
* @param string $queue
3535
*/
3636
public function __construct(Container $container, PubSubQueue $pubsub, Message $job, $connectionName, $queue)
3737
{
@@ -77,7 +77,7 @@ public function attempts()
7777
/**
7878
* Release the job back into the queue.
7979
*
80-
* @param int $delay
80+
* @param int $delay
8181
* @return void
8282
*/
8383
public function release($delay = 0)

tests/Unit/PubSubQueueTests.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function testPushRawOptionsOnlyAcceptKeyValueStrings()
142142
'foo' => 'bar',
143143
],
144144
1 => 'wrong key',
145-
'object' => new \StdClass,
145+
'object' => new \stdClass,
146146
];
147147

148148
$queue->pushRaw($payload, '', $options);
@@ -202,6 +202,9 @@ public function testPopWhenJobsAvailable()
202202
$this->queue->method('getTopic')
203203
->willReturn($this->topic);
204204

205+
$this->message->method('data')
206+
->willReturn(base64_encode(json_encode(['foo' => 'bar'])));
207+
205208
$this->queue->setContainer($this->createMock(Container::class));
206209

207210
$this->assertTrue($this->queue->pop('test') instanceof PubSubJob);
@@ -380,7 +383,7 @@ public function testRepublishOptionsOnlyAcceptString()
380383
'foo' => 'bar',
381384
],
382385
1 => 'wrong key',
383-
'object' => new \StdClass,
386+
'object' => new \stdClass,
384387
];
385388

386389
$this->queue->republish($this->message, 'test', $options, $delay);

0 commit comments

Comments
 (0)