Skip to content

Commit dc8c965

Browse files
authored
Merge pull request #17 from clue-labs/php8.3
Run tests on PHP 8.3 and update test suite
2 parents edd6f69 + 934d598 commit dc8c965

13 files changed

+89
-32
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,17 @@ jobs:
1111
strategy:
1212
matrix:
1313
php:
14+
- 8.3
15+
- 8.2
16+
- 8.1
17+
- 8.0
18+
- 7.4
19+
- 7.3
20+
- 7.2
21+
- 7.1
22+
- 7.0
23+
- 5.6
24+
- 5.5
1425
- 5.4
1526
- 5.3
1627
steps:
@@ -21,3 +32,6 @@ jobs:
2132
coverage: xdebug
2233
- run: composer install
2334
- run: vendor/bin/phpunit --coverage-text
35+
if: ${{ matrix.php >= 7.3 }}
36+
- run: vendor/bin/phpunit --coverage-text -c phpunit.xml.legacy
37+
if: ${{ matrix.php < 7.3 }}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"php": ">=5.3"
1515
},
1616
"require-dev": {
17-
"phpunit/phpunit": "^4.8.36"
17+
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36"
1818
},
1919
"autoload": {
2020
"psr-0": {

phpunit.xml.dist

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<!-- PHPUnit configuration file with old format for legacy PHPUnit -->
3+
<!-- PHPUnit configuration file with new format for PHPUnit 9.6+ -->
44
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5-
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.6/phpunit.xsd"
66
bootstrap="vendor/autoload.php"
7-
colors="true">
7+
cacheResult="false"
8+
colors="true"
9+
convertDeprecationsToExceptions="true">
810
<testsuites>
911
<testsuite name="Redis Protocol Test Suite">
1012
<directory>./tests/</directory>
1113
</testsuite>
1214
</testsuites>
13-
<filter>
14-
<whitelist>
15+
<coverage>
16+
<include>
1517
<directory>./src/</directory>
16-
</whitelist>
17-
</filter>
18+
</include>
19+
</coverage>
1820
<php>
1921
<ini name="error_reporting" value="-1" />
2022
</php>

phpunit.xml.legacy

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!-- PHPUnit configuration file with old format for legacy PHPUnit -->
4+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/4.8/phpunit.xsd"
6+
bootstrap="vendor/autoload.php"
7+
colors="true">
8+
<testsuites>
9+
<testsuite name="Redis Protocol Test Suite">
10+
<directory>./tests/</directory>
11+
</testsuite>
12+
</testsuites>
13+
<filter>
14+
<whitelist>
15+
<directory>./src/</directory>
16+
</whitelist>
17+
</filter>
18+
<php>
19+
<ini name="error_reporting" value="-1" />
20+
</php>
21+
</phpunit>

tests/FactoryTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ class FactoryTest extends TestCase
66
{
77
private $factory;
88

9-
public function setUp()
9+
/**
10+
* @before
11+
*/
12+
public function setUpFactory()
1013
{
1114
$this->factory = new Factory();
1215
}

tests/Model/AbstractModelTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ abstract class AbstractModelTest extends TestCase
88

99
abstract protected function createModel($value);
1010

11-
public function setUp()
11+
/**
12+
* @before
13+
*/
14+
public function setUpSerializer()
1215
{
1316
$this->serializer = new RecursiveSerializer();
1417
}

tests/Model/ErrorReplyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class ErrorReplyTest extends AbstractModelTest
66
{
77
protected function createModel($value)
88
{
9-
return new ErrorReply($value);
9+
return new ErrorReply((string) $value);
1010
}
1111

1212
public function testError()

tests/Model/MultiBulkReplyTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ public function testNullMultiBulkReply()
3636
/**
3737
* @param MultiBulkReply $model
3838
* @depends testNullMultiBulkReply
39-
* @expectedException UnexpectedValueException
4039
*/
4140
public function testNullMultiBulkReplyIsNotARequest(MultiBulkReply $model)
4241
{
42+
$this->setExpectedException('UnexpectedValueException');
4343
$model->getRequestModel();
4444
}
4545

@@ -91,10 +91,10 @@ public function testMixedReply()
9191
/**
9292
* @param MultiBulkReply $model
9393
* @depends testMixedReply
94-
* @expectedException UnexpectedValueException
9594
*/
9695
public function testMixedReplyIsNotARequest(MultiBulkReply $model)
9796
{
97+
$this->setExpectedException('UnexpectedValueException');
9898
$model->getRequestModel();
9999
}
100100

tests/Parser/AbstractParserTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ abstract class AbstractParserTest extends TestCase
1313

1414
abstract protected function createParser();
1515

16-
public function setUp()
16+
/**
17+
* @before
18+
*/
19+
public function setUpParser()
1720
{
1821
$this->parser = $this->createParser();
1922
$this->assertInstanceOf('Clue\Redis\Protocol\Parser\ParserInterface', $this->parser);

tests/Parser/RequestParserTest.php

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,23 +110,19 @@ public function testWhitespaceInlineIsIgnored()
110110
$this->assertEquals(array(), $this->parser->pushIncoming($message));
111111
}
112112

113-
/**
114-
* @expectedException Clue\Redis\Protocol\Parser\ParserException
115-
*/
116113
public function testInvalidMultiBulkMustContainBulk()
117114
{
118115
$message = "*1\r\n:123\r\n";
119116

117+
$this->setExpectedException('Clue\Redis\Protocol\Parser\ParserException');
120118
$this->parser->pushIncoming($message);
121119
}
122120

123-
/**
124-
* @expectedException Clue\Redis\Protocol\Parser\ParserException
125-
*/
126121
public function testInvalidBulkLength()
127122
{
128123
$message = "*1\r\n$-1\r\n";
129124

125+
$this->setExpectedException('Clue\Redis\Protocol\Parser\ParserException');
130126
$this->parser->pushIncoming($message);
131127
}
132128
}

0 commit comments

Comments
 (0)