diff --git a/.phpcs.xml.dist b/.phpcs.xml.dist index 23ccb1c35..bca2cd08f 100644 --- a/.phpcs.xml.dist +++ b/.phpcs.xml.dist @@ -17,7 +17,7 @@ */library/Requests/IRI\.php$ - */tests/IRI\.php$ + */tests/IRITest\.php$ */vendor/* */tests/coverage/ diff --git a/composer.json b/composer.json index 1b61196b2..00d7f0637 100644 --- a/composer.json +++ b/composer.json @@ -54,6 +54,11 @@ "Requests": "library/" } }, + "autoload-dev": { + "psr-4": { + "Requests\\Tests\\": "tests/" + } + }, "scripts": { "lint": [ "@php ./vendor/php-parallel-lint/php-parallel-lint/parallel-lint . -e php --exclude vendor --exclude .git" diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 48856b5eb..d14f496a5 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -8,26 +8,8 @@ verbose="true" > - - tests/Auth - - - tests/Transport - - - tests/Proxy - - - tests/ChunkedEncoding.php - tests/Cookies.php - tests/Encoding.php - tests/IDNAEncoder.php - tests/IRI.php - tests/Requests.php - tests/Response/Headers.php - tests/Session.php - tests/SSL.php - tests/Utility/FilteredIterator.php + + tests diff --git a/tests/Auth/Basic.php b/tests/Auth/BasicTest.php similarity index 94% rename from tests/Auth/Basic.php rename to tests/Auth/BasicTest.php index eff132613..d7bbdcb96 100644 --- a/tests/Auth/Basic.php +++ b/tests/Auth/BasicTest.php @@ -1,6 +1,12 @@ body = $body; $transport->chunked = true; @@ -62,7 +68,7 @@ public static function notChunkedProvider() { * @dataProvider notChunkedProvider */ public function testNotActuallyChunked($body) { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->body = $body; $transport->chunked = true; @@ -80,7 +86,7 @@ public function testNotActuallyChunked($body) { * that they're lying to us */ public function testMixedChunkiness() { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->body = "02\r\nab\r\nNot actually chunked!"; $transport->chunked = true; diff --git a/tests/Cookies.php b/tests/CookiesTest.php similarity index 98% rename from tests/Cookies.php rename to tests/CookiesTest.php index 03c6aa5ea..24655544a 100644 --- a/tests/Cookies.php +++ b/tests/CookiesTest.php @@ -1,6 +1,17 @@ data; diff --git a/tests/Mock/Transport.php b/tests/Mock/TransportMock.php similarity index 96% rename from tests/Mock/Transport.php rename to tests/Mock/TransportMock.php index 42580fab2..a0af0a186 100644 --- a/tests/Mock/Transport.php +++ b/tests/Mock/TransportMock.php @@ -1,6 +1,10 @@ expectException('Requests_Exception'); @@ -17,7 +25,7 @@ public function testDefaultTransport() { * Standard response header parsing */ public function testHeaderParsing() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/1.0 200 OK\r\n" . "Host: localhost\r\n" . @@ -52,7 +60,7 @@ public function testHeaderParsing() { } public function testProtocolVersionParsing() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/1.0 200 OK\r\n" . "Host: localhost\r\n\r\n"; @@ -66,7 +74,7 @@ public function testProtocolVersionParsing() { } public function testRawAccess() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/1.0 200 OK\r\n" . "Host: localhost\r\n\r\n" . @@ -83,7 +91,7 @@ public function testRawAccess() { * Headers with only \n delimiting should be treated as if they're \r\n */ public function testHeaderOnlyLF() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/1.0 200 OK\r\nTest: value\nAnother-Test: value\r\n\r\n"; $options = array( @@ -101,7 +109,7 @@ public function testHeaderOnlyLF() { * new issue, and update your server/proxy to support a proper protocol. */ public function testInvalidProtocolVersion() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/0.9 200 OK\r\n\r\n

Test"; $options = array( @@ -117,7 +125,7 @@ public function testInvalidProtocolVersion() { * HTTP/0.9 also appears to use a single CRLF instead of two. */ public function testSingleCRLFSeparator() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/0.9 200 OK\r\n

Test"; $options = array( @@ -130,7 +138,7 @@ public function testSingleCRLFSeparator() { } public function testInvalidStatus() { - $transport = new RequestsTest_Mock_RawTransport(); + $transport = new RawTransportMock(); $transport->data = "HTTP/1.1 OK\r\nTest: value\nAnother-Test: value\r\n\r\nTest"; $options = array( @@ -143,7 +151,7 @@ public function testInvalidStatus() { } public function test30xWithoutLocation() { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->code = 302; $options = array( diff --git a/tests/Response/Headers.php b/tests/Response/HeadersTest.php similarity index 91% rename from tests/Response/Headers.php rename to tests/Response/HeadersTest.php index 65f2b838b..34224428f 100644 --- a/tests/Response/Headers.php +++ b/tests/Response/HeadersTest.php @@ -1,6 +1,11 @@ transport, 'test'); $supported = call_user_func($callback); @@ -383,7 +392,7 @@ public static function statusCodeSuccessProvider() { * @dataProvider statusCodeSuccessProvider */ public function testStatusCode($code, $success) { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->code = $code; $url = sprintf(httpbin('/status/%d'), $code); @@ -401,7 +410,7 @@ public function testStatusCode($code, $success) { * @dataProvider statusCodeSuccessProvider */ public function testStatusCodeThrow($code, $success) { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->code = $code; $url = sprintf(httpbin('/status/%d'), $code); @@ -431,7 +440,7 @@ public function testStatusCodeThrow($code, $success) { * @dataProvider statusCodeSuccessProvider */ public function testStatusCodeThrowAllowRedirects($code, $success) { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->code = $code; $url = sprintf(httpbin('/status/%d'), $code); @@ -455,7 +464,7 @@ public function testStatusCodeThrowAllowRedirects($code, $success) { } public function testStatusCodeUnknown() { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->code = 599; $options = array( @@ -468,7 +477,7 @@ public function testStatusCodeUnknown() { } public function testStatusCodeThrowUnknown() { - $transport = new RequestsTest_Mock_Transport(); + $transport = new TransportMock(); $transport->code = 599; $options = array( diff --git a/tests/Transport/cURL.php b/tests/Transport/CURLTest.php similarity index 96% rename from tests/Transport/cURL.php rename to tests/Transport/CURLTest.php index 7f7c41774..13567dd6f 100644 --- a/tests/Transport/cURL.php +++ b/tests/Transport/CURLTest.php @@ -1,6 +1,11 @@