8000 Forward compatibility with PHPUnit 7 and PHPUnit 6 · SimonFrings/reactphp-redis@f7a6221 · GitHub
[go: up one dir, main page]

Skip to content

Commit f7a6221

Browse files
committed
Forward compatibility with PHPUnit 7 and PHPUnit 6
1 parent c1232de commit f7a6221

File tree

5 files changed

+25
-5
lines changed

5 files changed

+25
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
},
2424
"require-dev": {
2525
"clue/block-react": "^1.1",
26-
"phpunit/phpunit": "^5.0 || ^4.8"
26+
"phpunit/phpunit": "^7.0 || ^6.0 || ^5.0 || ^4.8.35"
2727
}
2828
}

tests/FactoryTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public function setUp()
1616
$this->factory = new Factory($this->loop, $this->connector);
1717
}
1818

19+
/**
20+
* @doesNotPerformAssertions
21+
*/
1922
public function testCtor()
2023
{
2124
$this->factory = new Factory($this->loop);

tests/FunctionalTest.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ public function testInvalidCommand()
6767
{
6868
$promise = $this->client->doesnotexist(1, 2, 3);
6969

70-
$this->setExpectedException('Exception');
70+
if (method_exists($this, 'expectException')) {
71+
$this->expectException('Exception');
72+
} else {
73+
$this->setExpectedException('Exception');
74+
}
7175
Block\await($promise, $this->loop);
7276
}
7377

@@ -131,7 +135,11 @@ public function testInvalidProtocol()
131135

132136
$promise = $client->get('willBeRejectedDueToClosing');
133137

134-
$this->setExpectedException('Exception');
138+
if (method_exists($this, 'expectException')) {
139+
$this->expectException('Exception');
140+
} else {
141+
$this->setExpectedException('Exception');
142+
}
135143
Block\await($promise, $this->loop);
136144
}
137145

tests/StreamingClientTest.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ public function testReceiveThrowMessageEmitsErrorEvent()
7373
$this->stream->emit('data', array('message'));
7474
}
7575

76+
/**
77+
* @doesNotPerformAssertions
78+
*/
7679
public function testDefaultCtor()
7780
{
7881
$client = new StreamingClient($this->stream);
@@ -160,7 +163,11 @@ public function testClosingMultipleTimesEmitsOnce()
160163

161164
public function testReceivingUnexpectedMessageThrowsException()
162165
{
163-
$this->setExpectedException('UnderflowException');
166+
if (method_exists($this, 'expectException')) {
167+
$this->expectException('UnderflowException');
168+
} else {
169+
$this->setExpectedException('UnderflowException');
170+
}
164171
$this->client->handleMessage(new BulkReply('PONG'));
165172
}
166173

tests/bootstrap.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?php
22

3+
use PHPUnit\Framework\TestCase as BaseTestCase;
4+
35
(include_once __DIR__ . '/../vendor/autoload.php') OR die(PHP_EOL . 'ERROR: composer autoloader not found, run "composer install" or see README for instructions' . PHP_EOL);
46

5-
class TestCase extends PHPUnit_Framework_TestCase
7+
class TestCase extends BaseTestCase
68
{
79
protected function expectCallableOnce()
810
{

0 commit comments

Comments
 (0)
0