Skip to content

Commit 679394e

Browse files
committed
- Add PHP 8.1 / 8.2 unit tests
- Updated code to be PHP 8.2 compliant
2 parents ef82313 + 3c7e20e commit 679394e

11 files changed

+200
-15
lines changed

.gitlab-ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88

99
# Install pcntl and redis extentions
1010
pecl install -o -f redis \
11-
&& rm -rf /tmp/pear \
12-
&& docker-php-ext-enable redis
11+
&& rm -rf /tmp/pear \
12+
&& docker-php-ext-enable redis
1313
docker-php-ext-install pcntl
1414

1515
# Install Composer

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.1.0 (2023-02-07)
2+
- Add PHP 8.1 / 8.2 unit tests
3+
- Updated code to be PHP 8.2 compliant
4+
15
## 2.0.3 (2022-09-12)
26
- Update composer packages
37
- Added WoodpeckerCI tests

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
php-resque: PHP Resque Worker (and Enqueue)
22
===========================================
33

4-
[![Build Status](https://ci.tinker.nz/api/badges/idanoo/php-resque/status.svg)](https://ci.tinker.nz/idanoo/php-resque)
5-
64
Resque is a Redis-backed library for creating background jobs, placing
75
those jobs on one or more queues, and processing them later.
86

composer.json

+11-4
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"description": "Redis backed library for creating background jobs and processing them later. Based on resque for Ruby. Originally forked from chrisboulton/php-resque.",
99
"keywords": ["job", "background", "redis", "resque", "php"],
10-
"homepage": "https://tinker.nz/idanoo/php-resque/",
10+
"homepage": "https://gitlab.com/idanoo/php-resque/",
1111
"license": "MIT",
1212
"authors": [
1313
{
@@ -22,7 +22,9 @@
2222
},
2323
"require-dev": {
2424
"phpunit/phpunit": "^9",
25-
"squizlabs/php_codesniffer": "3.*"
25+
"squizlabs/php_codesniffer": "3.*",
26+
"phpcompatibility/php-compatibility": "^9.3",
27+
"dealerdirect/phpcodesniffer-composer-installer": "^1.0"
2628
},
2729
"bin": [
2830
"bin/resque"
@@ -38,7 +40,12 @@
3840
}
3941
},
4042
"support": {
41-
"issues": "https://tinker.nz/idanoo/php-resque/issues",
42-
"source": "https://tinker.nz/idanoo/php-resque"
43+
"issues": "https://gitlab.com/idanoo/php-resque/issues",
44+
"source": "https://gitlab.com/idanoo/php-resque"
45+
},
46+
"config": {
47+
"allow-plugins": {
48+
"dealerdirect/phpcodesniffer-composer-installer": true
49+
}
4350
}
4451
}

composer.lock

+141-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ruleset.xml

+14-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
<?xml version="1.0"?>
2-
<ruleset name="phpresque" namespace="ezyVet\PHPCS">
3-
<description>PSR12</description>
2+
<ruleset name="PHP82" namespace="ezyVet\PHPCS">
3+
<description>PHP8.2 Ruleset</description>
44

55
<file>.</file>
6-
7-
<exclude-pattern>vendor/</exclude-pattern>
6+
<exclude-pattern>vendor</exclude-pattern>
87
<exclude-pattern>tests/</exclude-pattern>
98

109
<arg name="extensions" value="php" />
1110
<arg name="colors"/>
1211
<arg value="sp"/>
1312
<arg name="parallel" value="16"/>
1413
<arg name="report-width" value="140" />
14+
<arg name="error-severity" value="1" />
15+
<!-- Setting warning-severity here overrides both the '-n' CLI option and 'config-set show_warnings 0', so we
16+
can't use it. -->
17+
1518
<ini name="memory_limit" value="256M"/>
1619

20+
<!-- Check for version support for PHP 8.2 and higher. -->
21+
<config name="testVersion" value="8.2-"/>
22+
23+
1724
<rule ref="PSR12">
1825
</rule>
26+
27+
<rule ref="PHPCompatibility">
28+
</rule>
1929
</ruleset>

src/Resque/Job/Factory.php

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
*/
1212
class Factory implements FactoryInterface
1313
{
14+
public ?Job $job;
15+
public string $queue;
16+
public array $args;
17+
1418
/**
1519
* @param $className
1620
* @param array $args

src/Resque/Job/Job.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ public function getArguments()
174174
*/
175175
public function getInstance()
176176
{
177-
if (!is_null($this->instance)) {
177+
if (isset($this->instance) && !is_null($this->instance)) {
178178
return $this->instance;
179179
}
180180

src/Resque/Resque.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
class Resque
1414
{
15-
public const VERSION = '2.0.3';
15+
public const VERSION = '2.1.0';
1616

1717
public const DEFAULT_INTERVAL = 5;
1818

tests/Resque/Tests/JobTest.php

+10
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,11 @@ public function testUseFactoryToGetJobInstance()
397397

398398
class SomeJobClass implements \Resque\Job\JobInterface
399399
{
400+
public static $called = false;
401+
public $args = false;
402+
public $queue;
403+
public $job;
404+
400405
/**
401406
* @return bool
402407
*/
@@ -408,6 +413,11 @@ public function perform()
408413

409414
class Some_Stub_Factory implements \Resque\Job\FactoryInterface
410415
{
416+
public static $called = false;
417+
public $args = false;
418+
public $queue;
419+
public $job;
420+
411421
/**
412422
* @param $className
413423
* @param array $args

tests/bootstrap.php

+12
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
class TestJob
3636
{
3737
public static $called = false;
38+
public $args = false;
39+
public $queue;
40+
public $job;
3841

3942
public function perform()
4043
{
@@ -48,6 +51,11 @@ class FailingJobException extends \Exception
4851

4952
class FailingJob
5053
{
54+
public static $called = false;
55+
public $args = false;
56+
public $queue;
57+
public $job;
58+
5159
public function perform()
5260
{
5361
throw new FailingJobException('Message!');
@@ -62,6 +70,8 @@ class TestJobWithSetUp
6270
{
6371
public static $called = false;
6472
public $args = false;
73+
public $queue;
74+
public $job;
6575

6676
public function setUp()
6777
{
@@ -78,6 +88,8 @@ class TestJobWithTearDown
7888
{
7989
public static $called = false;
8090
public $args = false;
91+
public $queue;
92+
public $job;
8193

8294
public function perform()
8395
{

0 commit comments

Comments
 (0)