Upgrade PHPUnit to ^6

This commit is contained in:
PJ Dietz 2017-07-22 15:21:41 -04:00
parent 353b48394b
commit 36a170bcff
25 changed files with 584 additions and 343 deletions

View File

@ -16,7 +16,7 @@
"psr/http-message": "~1.0" "psr/http-message": "~1.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^5" "phpunit/phpunit": "^6"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

746
composer.lock generated

File diff suppressed because it is too large Load Diff

7
test/src/TestCase.php Normal file
View File

@ -0,0 +1,7 @@
<?php
namespace WellRESTed\Test;
class TestCase extends \PHPUnit\Framework\TestCase
{
}

View File

@ -2,7 +2,6 @@
namespace WellRESTed\Test\Integration; namespace WellRESTed\Test\Integration;
use Prophecy\Argument;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use WellRESTed\Message\Response; use WellRESTed\Message\Response;
@ -10,12 +9,13 @@ use WellRESTed\Message\ServerRequest;
use WellRESTed\Message\Stream; use WellRESTed\Message\Stream;
use WellRESTed\MiddlewareInterface; use WellRESTed\MiddlewareInterface;
use WellRESTed\Server; use WellRESTed\Server;
use WellRESTed\Test\TestCase;
use WellRESTed\Transmission\TransmitterInterface; use WellRESTed\Transmission\TransmitterInterface;
/** /**
* @coversNothing * @coversNothing
*/ */
class ServerTest extends \PHPUnit_Framework_TestCase class ServerTest extends TestCase
{ {
public function testDispatchesMiddleware() public function testDispatchesMiddleware()
{ {

View File

@ -7,12 +7,9 @@ use WellRESTed\Dispatching\DispatchStack;
use WellRESTed\Message\Response; use WellRESTed\Message\Response;
use WellRESTed\Message\ServerRequest; use WellRESTed\Message\ServerRequest;
use WellRESTed\Test\Doubles\NextMock; use WellRESTed\Test\Doubles\NextMock;
use WellRESTed\Test\TestCase;
/** class DispatchStackTest extends TestCase
* @covers WellRESTed\Dispatching\DispatchStack
* @group dispatching
*/
class DispatchStackTest extends \PHPUnit_Framework_TestCase
{ {
private $request; private $request;
private $response; private $response;

View File

@ -2,7 +2,6 @@
namespace WellRESTed\Test\Unit\Dispatching; namespace WellRESTed\Test\Unit\Dispatching;
use Prophecy\Argument;
use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ServerRequestInterface;
use WellRESTed\Dispatching\Dispatcher; use WellRESTed\Dispatching\Dispatcher;
@ -10,12 +9,9 @@ use WellRESTed\Message\Response;
use WellRESTed\Message\ServerRequest; use WellRESTed\Message\ServerRequest;
use WellRESTed\MiddlewareInterface; use WellRESTed\MiddlewareInterface;
use WellRESTed\Test\Doubles\NextMock; use WellRESTed\Test\Doubles\NextMock;
use WellRESTed\Test\TestCase;
/** class DispatcherTest extends TestCase
* @covers WellRESTed\Dispatching\Dispatcher
* @group dispatching
*/
class DispatcherTest extends \PHPUnit_Framework_TestCase
{ {
private $request; private $request;
private $response; private $response;

View File

@ -3,12 +3,9 @@
namespace WellRESTed\Test\Unit\Message; namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\HeaderCollection; use WellRESTed\Message\HeaderCollection;
use WellRESTed\Test\TestCase;
/** class HeaderCollectionTest extends TestCase
* @covers WellRESTed\Message\HeaderCollection
* @group message
*/
class HeaderCollectionTest extends \PHPUnit_Framework_TestCase
{ {
public function testAddsSingleHeaderAndIndicatesCaseInsensitiveIsset() public function testAddsSingleHeaderAndIndicatesCaseInsensitiveIsset()
{ {

View File

@ -2,11 +2,9 @@
namespace WellRESTed\Test\Unit\Message; namespace WellRESTed\Test\Unit\Message;
/** use WellRESTed\Test\TestCase;
* @covers WellRESTed\Message\Message
* @group message class MessageTest extends TestCase
*/
class MessageTest extends \PHPUnit_Framework_TestCase
{ {
public function testSetsHeadersOnConstruction() public function testSetsHeadersOnConstruction()
{ {

View File

@ -3,12 +3,9 @@
namespace WellRESTed\Test\Unit\Message; namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\NullStream; use WellRESTed\Message\NullStream;
use WellRESTed\Test\TestCase;
/** class NullStreamTest extends TestCase
* @covers WellRESTed\Message\NullStream
* @group message
*/
class NullStreamTest extends \PHPUnit_Framework_TestCase
{ {
public function testCastsToString() public function testCastsToString()
{ {

View File

@ -5,12 +5,9 @@ namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\NullStream; use WellRESTed\Message\NullStream;
use WellRESTed\Message\Request; use WellRESTed\Message\Request;
use WellRESTed\Message\Uri; use WellRESTed\Message\Uri;
use WellRESTed\Test\TestCase;
/** class RequestTest extends TestCase
* @covers WellRESTed\Message\Request
* @group message
*/
class RequestTest extends \PHPUnit_Framework_TestCase
{ {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Construction // Construction

View File

@ -4,12 +4,9 @@ namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\NullStream; use WellRESTed\Message\NullStream;
use WellRESTed\Message\Response; use WellRESTed\Message\Response;
use WellRESTed\Test\TestCase;
/** class ResponseTest extends TestCase
* @covers WellRESTed\Message\Response
* @group message
*/
class ResponseTest extends \PHPUnit_Framework_TestCase
{ {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Construction // Construction

View File

@ -6,12 +6,9 @@ use WellRESTed\Message\NullStream;
use WellRESTed\Message\ServerRequest; use WellRESTed\Message\ServerRequest;
use WellRESTed\Message\UploadedFile; use WellRESTed\Message\UploadedFile;
use WellRESTed\Message\Uri; use WellRESTed\Message\Uri;
use WellRESTed\Test\TestCase;
/** class ServerRequestTest extends TestCase
* @covers WellRESTed\Message\ServerRequest
* @group message
*/
class ServerRequestTest extends \PHPUnit_Framework_TestCase
{ {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Construction and Marshalling // Construction and Marshalling

View File

@ -3,12 +3,9 @@
namespace WellRESTed\Test\Unit\Message; namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\Stream; use WellRESTed\Message\Stream;
use WellRESTed\Test\TestCase;
/** class StreamTest extends TestCase
* @covers WellRESTed\Message\Stream
* @group message
*/
class StreamTest extends \PHPUnit_Framework_TestCase
{ {
private $resource; private $resource;
private $content = "Hello, world!"; private $content = "Hello, world!";

View File

@ -4,15 +4,12 @@ namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\UploadedFile; use WellRESTed\Message\UploadedFile;
use WellRESTed\Message\UploadedFileState; use WellRESTed\Message\UploadedFileState;
use WellRESTed\Test\TestCase;
// Hides several php core functions for testing. // Hides several php core functions for testing.
require_once __DIR__ . "/../../../src/UploadedFileState.php"; require_once __DIR__ . "/../../../src/UploadedFileState.php";
/** class UploadedFileTest extends TestCase
* @covers WellRESTed\Message\UploadedFile
* @group message
*/
class UploadedFileTest extends \PHPUnit_Framework_TestCase
{ {
private $tmpName; private $tmpName;
private $movePath; private $movePath;

View File

@ -3,12 +3,9 @@
namespace WellRESTed\Test\Unit\Message; namespace WellRESTed\Test\Unit\Message;
use WellRESTed\Message\Uri; use WellRESTed\Message\Uri;
use WellRESTed\Test\TestCase;
/** class UriTest extends TestCase
* @covers WellRESTed\Message\Uri
* @group message
*/
class UriTest extends \PHPUnit_Framework_TestCase
{ {
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
// Scheme // Scheme

View File

@ -2,19 +2,15 @@
namespace WellRESTed\Test\Unit\Routing; namespace WellRESTed\Test\Unit\Routing;
use Prophecy\Argument;
use WellRESTed\Dispatching\Dispatcher; use WellRESTed\Dispatching\Dispatcher;
use WellRESTed\Message\Response; use WellRESTed\Message\Response;
use WellRESTed\Message\ServerRequest; use WellRESTed\Message\ServerRequest;
use WellRESTed\Routing\MethodMap; use WellRESTed\Routing\MethodMap;
use WellRESTed\Test\Doubles\MiddlewareMock; use WellRESTed\Test\Doubles\MiddlewareMock;
use WellRESTed\Test\Doubles\NextMock; use WellRESTed\Test\Doubles\NextMock;
use WellRESTed\Test\TestCase;
/** class MethodMapTest extends TestCase
* @covers WellRESTed\Routing\MethodMap
* @group routing
*/
class MethodMapTest extends \PHPUnit_Framework_TestCase
{ {
private $dispatcher; private $dispatcher;
private $request; private $request;

View File

@ -2,16 +2,11 @@
namespace WellRESTed\Test\Unit\Routing\Route; namespace WellRESTed\Test\Unit\Routing\Route;
use Prophecy\Argument;
use WellRESTed\Routing\Route\PrefixRoute; use WellRESTed\Routing\Route\PrefixRoute;
use WellRESTed\Routing\Route\RouteInterface; use WellRESTed\Routing\Route\RouteInterface;
use WellRESTed\Test\TestCase;
/** class PrefixRouteTest extends TestCase
* @covers WellRESTed\Routing\Route\PrefixRoute
* @group route
* @group routing
*/
class PrefixRouteTest extends \PHPUnit_Framework_TestCase
{ {
public function testTrimsAsteriskFromEndOfTarget() public function testTrimsAsteriskFromEndOfTarget()
{ {

View File

@ -2,16 +2,12 @@
namespace WellRESTed\Test\Unit\Routing\Route; namespace WellRESTed\Test\Unit\Routing\Route;
use Prophecy\Argument; use PHPUnit\Framework\Error\Error;
use WellRESTed\Routing\Route\RegexRoute; use WellRESTed\Routing\Route\RegexRoute;
use WellRESTed\Routing\Route\RouteInterface; use WellRESTed\Routing\Route\RouteInterface;
use WellRESTed\Test\TestCase;
/** class RegexRouteTest extends TestCase
* @covers WellRESTed\Routing\Route\RegexRoute
* @group route
* @group routing
*/
class RegexRouteTest extends \PHPUnit_Framework_TestCase
{ {
private $methodMap; private $methodMap;
@ -88,14 +84,14 @@ class RegexRouteTest extends \PHPUnit_Framework_TestCase
public function testThrowsExceptionOnInvalidPattern($pattern) public function testThrowsExceptionOnInvalidPattern($pattern)
{ {
$route = new RegexRoute($pattern, $this->methodMap->reveal()); $route = new RegexRoute($pattern, $this->methodMap->reveal());
\PHPUnit_Framework_Error_Warning::$enabled = false; \PHPUnit\Framework\Error\Warning::$enabled = false;
\PHPUnit_Framework_Error_Notice::$enabled = false; \PHPUnit\Framework\Error\Notice::$enabled = false;
$level = error_reporting(); $level = error_reporting();
error_reporting($level & ~E_WARNING); error_reporting($level & ~E_WARNING);
$route->matchesRequestTarget("/"); $route->matchesRequestTarget("/");
error_reporting($level); error_reporting($level);
\PHPUnit_Framework_Error_Warning::$enabled = true; \PHPUnit\Framework\Error\Warning::$enabled = true;
\PHPUnit_Framework_Error_Notice::$enabled = true; \PHPUnit\Framework\Error\Notice::$enabled = true;
} }
public function invalidRouteProvider() public function invalidRouteProvider()

View File

@ -2,16 +2,11 @@
namespace WellRESTed\Test\Unit\Routing\Route; namespace WellRESTed\Test\Unit\Routing\Route;
use Prophecy\Argument;
use WellRESTed\Routing\Route\RouteFactory; use WellRESTed\Routing\Route\RouteFactory;
use WellRESTed\Routing\Route\RouteInterface; use WellRESTed\Routing\Route\RouteInterface;
use WellRESTed\Test\TestCase;
/** class RouteFactoryTest extends TestCase
* @covers WellRESTed\Routing\Route\RouteFactory
* @group route
* @group routing
*/
class RouteFactoryTest extends \PHPUnit_Framework_TestCase
{ {
private $dispatcher; private $dispatcher;

View File

@ -3,13 +3,9 @@
namespace WellRESTed\Test\Unit\Routing\Route; namespace WellRESTed\Test\Unit\Routing\Route;
use Prophecy\Argument; use Prophecy\Argument;
use WellRESTed\Test\TestCase;
/** class RouteTest extends TestCase
* @covers WellRESTed\Routing\Route\Route
* @group route
* @group routing
*/
class RouteTest extends \PHPUnit_Framework_TestCase
{ {
public function testCreatesInstance() public function testCreatesInstance()
{ {

View File

@ -2,16 +2,11 @@
namespace WellRESTed\Test\Unit\Routing\Route; namespace WellRESTed\Test\Unit\Routing\Route;
use Prophecy\Argument;
use WellRESTed\Routing\Route\RouteInterface; use WellRESTed\Routing\Route\RouteInterface;
use WellRESTed\Routing\Route\StaticRoute; use WellRESTed\Routing\Route\StaticRoute;
use WellRESTed\Test\TestCase;
/** class StaticRouteTest extends TestCase
* @covers WellRESTed\Routing\Route\StaticRoute
* @group route
* @group routing
*/
class StaticRouteTest extends \PHPUnit_Framework_TestCase
{ {
public function testReturnsStaticType() public function testReturnsStaticType()
{ {

View File

@ -2,16 +2,11 @@
namespace WellRESTed\Test\Unit\Routing\Route; namespace WellRESTed\Test\Unit\Routing\Route;
use Prophecy\Argument;
use WellRESTed\Routing\Route\RouteInterface; use WellRESTed\Routing\Route\RouteInterface;
use WellRESTed\Routing\Route\TemplateRoute; use WellRESTed\Routing\Route\TemplateRoute;
use WellRESTed\Test\TestCase;
/** class TemplateRouteTest extends TestCase
* @covers WellRESTed\Routing\Route\TemplateRoute
* @group route
* @group routing
*/
class TemplateRouteTest extends \PHPUnit_Framework_TestCase
{ {
private $methodMap; private $methodMap;

View File

@ -9,14 +9,10 @@ use WellRESTed\Message\ServerRequest;
use WellRESTed\Routing\Route\RouteInterface; use WellRESTed\Routing\Route\RouteInterface;
use WellRESTed\Routing\Router; use WellRESTed\Routing\Router;
use WellRESTed\Test\Doubles\NextMock; use WellRESTed\Test\Doubles\NextMock;
use WellRESTed\Test\TestCase;
/** class RouterTest extends TestCase
* @covers WellRESTed\Routing\Router
* @group routing
*/
class RouterTest extends \PHPUnit_Framework_TestCase
{ {
private $dispatcher;
private $methodMap; private $methodMap;
private $factory; private $factory;
private $request; private $request;

View File

@ -7,9 +7,9 @@ use WellRESTed\Message\Response;
use WellRESTed\Message\ServerRequest; use WellRESTed\Message\ServerRequest;
use WellRESTed\Server; use WellRESTed\Server;
use WellRESTed\Test\Doubles\NextMock; use WellRESTed\Test\Doubles\NextMock;
use WellRESTed\Test\TestCase;
/** @covers WellRESTed\Server */ class ServerTest extends TestCase
class ServerTest extends \PHPUnit_Framework_TestCase
{ {
private $dispatcher; private $dispatcher;
private $next; private $next;

View File

@ -6,16 +6,13 @@ use Prophecy\Argument;
use Psr\Http\Message\StreamInterface; use Psr\Http\Message\StreamInterface;
use WellRESTed\Message\Response; use WellRESTed\Message\Response;
use WellRESTed\Message\ServerRequest; use WellRESTed\Message\ServerRequest;
use WellRESTed\Test\TestCase;
use WellRESTed\Transmission\HeaderStack; use WellRESTed\Transmission\HeaderStack;
use WellRESTed\Transmission\Transmitter; use WellRESTed\Transmission\Transmitter;
require_once __DIR__ . "/../../../src/HeaderStack.php"; require_once __DIR__ . "/../../../src/HeaderStack.php";
/** class TransmitterTest extends TestCase
* @covers WellRESTed\Transmission\Transmitter
* @group transmission
*/
class TransmitterTest extends \PHPUnit_Framework_TestCase
{ {
private $request; private $request;
private $response; private $response;