Skip to content

Commit d9a3c96

Browse files
authored
Merge pull request #20 from howkey666/phpunit
Make it compatible with PHP 7.2 and 7.3
2 parents a83215e + 30042b5 commit d9a3c96

File tree

5 files changed

+16
-9
lines changed

5 files changed

+16
-9
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: php
22
php:
3-
- 7.0
43
- 7.1
5-
- hhvm
4+
- 7.2
5+
- 7.3
66
install:
77
- composer install --prefer-source --no-interaction
88
- wget http://download.redis.io/redis-stable.tar.gz && tar xzf redis-stable.tar.gz && cd redis-stable && make

composer.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.0.0",
16-
"predis/predis": "~1.1.1"
15+
"php": ">=7.1.0",
16+
"predis/predis": "1.1.x-dev#157f658f0be5f48cb2aaa4b6a6ac753c1168f465"
1717
},
1818
"bin": [
1919
"php-rq-run-tests"
2020
],
2121
"require-dev": {
22-
"phpunit/phpunit": "~6.5.13",
23-
"mockery/mockery": "~0.9.4",
24-
"nette/finder": "~2.4"
22+
"phpunit/phpunit": "~7.5.15",
23+
"mockery/mockery": "~1.2.3",
24+
"nette/finder": "~2.5"
2525
},
2626
"autoload": {
2727
"psr-4": {

src/Pool.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public function getItems($size)
161161
$since = $this->time->now() - $this->options[self::OPT_PROCESS_TIME_OFFSET];
162162
$chunk = $this->redis->poolGet($this->name, $size, $since, $this->options[self::OPT_ACK_TTL]);
163163
$result = array_merge($result, $chunk);
164-
if (count($chunk) < count($size)) {
164+
if (count($chunk) < $size) {
165165
break;
166166
}
167167
}

tests/BaseTestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ abstract class BaseTestCase extends \PHPUnit\Framework\TestCase
3737
*/
3838
public function __construct(ClientInterface $redis)
3939
{
40+
parent::__construct();
41+
4042
$this->redis = $redis;
4143
}
4244

tests/TestRunner.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ public function run()
5454
call_user_func_array([$testCase, $methodName], (array)$args);
5555
}
5656
} else {
57-
$testCase = new $className($this->provider->getRedisClient());
57+
if ($className === 'PhpRQ\\BaseTest') {
58+
$testCase = new $className();
59+
} else {
60+
$testCase = new $className($this->provider->getRedisClient());
61+
}
62+
5863
$testCase->$methodName();
5964
}
6065
}

0 commit comments

Comments
 (0)