Skip to content

Commit 072b6bb

Browse files
committed
Revert "Revert "PHPUnit 6""
This reverts commit 05d95cf.
1 parent b878472 commit 072b6bb

6 files changed

+31
-31
lines changed

composer.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
}
1414
],
1515
"require": {
16-
"php": ">=5.6.0",
1716
"silex/silex": "~2.0",
1817
"guzzle/guzzle": "*",
1918
"symfony/process": "~3",
@@ -23,7 +22,7 @@
2322
"require-dev": {
2423
"internations/kodierungsregelwerksammlung": "~0.23.0",
2524
"internations/testing-component": "1.0.1",
26-
"phpunit/phpunit": "~5"
25+
"phpunit/phpunit": "~6"
2726
},
2827
"autoload": {
2928
"psr-4": {"InterNations\\Component\\HttpMock\\": "src/"}

tests/MockBuilderIntegrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use InterNations\Component\HttpMock\Matcher\MatcherFactory;
77
use InterNations\Component\HttpMock\MockBuilder;
88
use InterNations\Component\HttpMock\Server;
9-
use PHPUnit_Framework_TestCase as TestCase;
9+
use PHPUnit\Framework\TestCase;
1010
use DateTime;
1111
use DateTimeZone;
1212
use InterNations\Component\HttpMock\Tests\Fixtures\Request as TestRequest;

tests/PHPUnit/HttpMockMultiPHPUnitIntegrationTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33

44
use InterNations\Component\Testing\AbstractTestCase;
55
use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
6+
use PHPUnit\Framework\ExpectationFailedException;
67
use Symfony\Component\HttpFoundation\Response;
8+
use PHPUnit\Framework\TestCase;
79

810
/** @large */
911
class HttpMockMultiPHPUnitIntegrationTest extends AbstractTestCase
@@ -80,10 +82,9 @@ public function testSimpleRequest($path)
8082
$this->assertSame('GET', $request->getMethod());
8183
$this->assertSame($path, $request->getPath());
8284

83-
$this->setExpectedException(
84-
'UnexpectedValueException',
85-
'Expected status code 200 from "/_request/last", got 404'
86-
);
85+
$this->expectException('UnexpectedValueException');
86+
87+
$this->expectExceptionMessage('Expected status code 200 from "/_request/last", got 404');
8788
$this->http['firstNamedServer']->requests->pop();
8889
}
8990

@@ -102,7 +103,7 @@ public function testErrorLogOutput()
102103
try {
103104
$this->tearDown();
104105
$this->fail('Exception expected');
105-
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
106+
} catch (ExpectationFailedException $e) {
106107
$this->assertContains('HTTP mock server standard error output should be empty', $e->getMessage());
107108
}
108109
}

tests/PHPUnit/HttpMockPHPUnitIntegrationTest.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33

44
use InterNations\Component\HttpMock\PHPUnit\HttpMockTrait;
55
use InterNations\Component\Testing\AbstractTestCase;
6+
use PHPUnit\Framework\ExpectationFailedException;
67
use Symfony\Component\HttpFoundation\Request;
78
use Symfony\Component\HttpFoundation\Response;
9+
use PHPUnit\Framework\TestCase;
810

911
/** @large */
1012
class HttpMockPHPUnitIntegrationTest extends AbstractTestCase
@@ -80,10 +82,9 @@ public function testSimpleRequest($path)
8082
$this->assertSame('GET', $request->getMethod());
8183
$this->assertSame($path, $request->getPath());
8284

83-
$this->setExpectedException(
84-
'UnexpectedValueException',
85-
'Expected status code 200 from "/_request/last", got 404'
86-
);
85+
$this->expectException('UnexpectedValueException');
86+
87+
$this->expectExceptionMessage('Expected status code 200 from "/_request/last", got 404');
8788
$this->http->requests->pop();
8889
}
8990

@@ -102,7 +103,7 @@ public function testErrorLogOutput()
102103
try {
103104
$this->tearDown();
104105
$this->fail('Exception expected');
105-
} catch (\PHPUnit_Framework_ExpectationFailedException $e) {
106+
} catch (ExpectationFailedException $e) {
106107
$this->assertContains('HTTP mock server standard error output should be empty', $e->getMessage());
107108
}
108109
}

tests/Request/UnifiedRequestTest.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,15 @@ public function testEntityEnclosingInterfaceMethods($method, array $params = [])
112112
->method('getPath')
113113
->will($this->returnValue('/foo'));
114114

115-
$this->setExpectedException(
116-
'BadMethodCallException',
115+
$this->expectException('BadMethodCallException');
116+
117+
$this->expectExceptionMessage(
118+
117119
sprintf(
118120
'Cannot call method "%s" on a request that does not enclose an entity. Did you expect a POST/PUT request instead of METHOD /foo?',
119121
$method
120122
)
123+
121124
);
122125
call_user_func_array([$this->unifiedRequest, $method], $params);
123126
}

tests/RequestCollectionFacadeTest.php

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,9 @@ public function testRequestResponse_InvalidStatusCode($method, $path, array $arg
7474
{
7575
$this->mockClient($path, $this->createResponseWithInvalidStatusCode(), $httpMethod);
7676

77-
$this->setExpectedException(
78-
'UnexpectedValueException',
79-
'Expected status code 200 from "' . $path . '", got 404'
80-
);
77+
$this->expectException('UnexpectedValueException');
78+
79+
$this->expectExceptionMessage('Expected status code 200 from "' . $path . '", got 404');
8180
call_user_func_array([$this->facade, $method], $args);
8281
}
8382

@@ -86,10 +85,9 @@ public function testRequestResponse_EmptyContentType($method, $path, array $args
8685
{
8786
$this->mockClient($path, $this->createResponseWithEmptyContentType(), $httpMethod);
8887

89-
$this->setExpectedException(
90-
'UnexpectedValueException',
91-
'Expected content type "text/plain" from "' . $path . '", got ""'
92-
);
88+
$this->expectException('UnexpectedValueException');
89+
90+
$this->expectExceptionMessage('Expected content type "text/plain" from "' . $path . '", got ""');
9391
call_user_func_array([$this->facade, $method], $args);
9492
}
9593

@@ -98,10 +96,9 @@ public function testRequestResponse_InvalidContentType($method, $path, array $ar
9896
{
9997
$this->mockClient($path, $this->createResponseWithInvalidContentType(), $httpMethod);
10098

101-
$this->setExpectedException(
102-
'UnexpectedValueException',
103-
'Expected content type "text/plain" from "' . $path . '", got "text/html"'
104-
);
99+
$this->expectException('UnexpectedValueException');
100+
101+
$this->expectExceptionMessage('Expected content type "text/plain" from "' . $path . '", got "text/html"');
105102
call_user_func_array([$this->facade, $method], $args);
106103
}
107104

@@ -110,10 +107,9 @@ public function testRequestResponse_DeserializationError($method, $path, array $
110107
{
111108
$this->mockClient($path, $this->createResponseThatCannotBeDeserialized(), $httpMethod);
112109

113-
$this->setExpectedException(
114-
'UnexpectedValueException',
115-
'Cannot deserialize response from "' . $path . '": "invalid response"'
116-
);
110+
$this->expectException('UnexpectedValueException');
111+
112+
$this->expectExceptionMessage('Cannot deserialize response from "' . $path . '": "invalid response"');
117113
call_user_func_array([$this->facade, $method], $args);
118114
}
119115

0 commit comments

Comments
 (0)