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"
},
"require-dev": {
"phpunit/phpunit": "^5"
"phpunit/phpunit": "^6"
},
"autoload": {
"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;
use Prophecy\Argument;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use WellRESTed\Message\Response;
@ -10,12 +9,13 @@ use WellRESTed\Message\ServerRequest;
use WellRESTed\Message\Stream;
use WellRESTed\MiddlewareInterface;
use WellRESTed\Server;
use WellRESTed\Test\TestCase;
use WellRESTed\Transmission\TransmitterInterface;
/**
* @coversNothing
*/
class ServerTest extends \PHPUnit_Framework_TestCase
class ServerTest extends TestCase
{
public function testDispatchesMiddleware()
{

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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