Skip to content

Commit 908f2f5

Browse files
carusogabrielclue
authored andcommitted
Support PHPUnit 6
1 parent 5fdc7ef commit 908f2f5

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"require-dev": {
1616
"clue/block-react": "^1.2",
17-
"phpunit/phpunit": "^5.7 || ^4.8.35"
17+
"phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35"
1818
},
1919
"autoload": {
2020
"psr-4": {

tests/IntegrationTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ public function gettingPlaintextStuffFromEncryptedGoogleShouldNotWork()
9898
$this->assertNotRegExp('#^HTTP/1\.0#', $response);
9999
}
100100

101-
/** @test */
102101
public function testConnectingFailsIfDnsUsesInvalidResolver()
103102
{
104103
$loop = Factory::create();
@@ -114,7 +113,6 @@ public function testConnectingFailsIfDnsUsesInvalidResolver()
114113
Block\await($connector->connect('google.com:80'), $loop, self::TIMEOUT);
115114
}
116115

117-
/** @test */
118116
public function testConnectingFailsIfTimeoutIsTooSmall()
119117
{
120118
if (!function_exists('stream_socket_enable_crypto')) {
@@ -131,7 +129,6 @@ public function testConnectingFailsIfTimeoutIsTooSmall()
131129
Block\await($connector->connect('google.com:80'), $loop, self::TIMEOUT);
132130
}
133131

134-
/** @test */
135132
public function testSelfSignedRejectsIfVerificationIsEnabled()
136133
{
137134
if (!function_exists('stream_socket_enable_crypto')) {
@@ -150,7 +147,6 @@ public function testSelfSignedRejectsIfVerificationIsEnabled()
150147
Block\await($connector->connect('tls://self-signed.badssl.com:443'), $loop, self::TIMEOUT);
151148
}
152149

153-
/** @test */
154150
public function testSelfSignedResolvesIfVerificationIsDisabled()
155151
{
156152
if (!function_exists('stream_socket_enable_crypto')) {

tests/TestCase.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,4 +81,21 @@ function () use ($stream) {
8181
}
8282
), $loop, $timeout);
8383
}
84+
85+
public function setExpectedException($exception, $exceptionMessage = '', $exceptionCode = null)
86+
{
87+
if (method_exists($this, 'expectException')) {
88+
// PHPUnit 5+
89+
$this->expectException($exception);
90+
if ($exceptionMessage !== '') {
91+
$this->expectExceptionMessage($exceptionMessage);
92+
}
93+
if ($exceptionCode !== null) {
94+
$this->expectExceptionCode($exceptionCode);
95+
}
96+
} else {
97+
// legacy PHPUnit 4
98+
parent::setExpectedException($exception, $exceptionMessage, $exceptionCode);
99+
}
100+
}
84101
}

0 commit comments

Comments
 (0)