diff --git a/composer.json b/composer.json index 9936134fb..f770d8b1c 100644 --- a/composer.json +++ b/composer.json @@ -20,6 +20,7 @@ "league/fractal": "^0.17" }, "require-dev": { + "phpdocumentor/reflection-docblock": "3.3.2", "friendsofphp/php-cs-fixer": "~2", "illuminate/auth": "^5.1", "illuminate/cache": "^5.1", @@ -30,8 +31,8 @@ "illuminate/log": "^5.1", "illuminate/pagination": "^5.1", "laravel/lumen-framework": "^5.1", - "mockery/mockery": "~0.9", - "phpunit/phpunit": "^4.8 || ^5.0", + "mockery/mockery": "~1.0", + "phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.5", "squizlabs/php_codesniffer": "~2.0", "tymon/jwt-auth": "1.0.*" }, @@ -69,4 +70,4 @@ }, "minimum-stability": "dev", "prefer-stable": true -} \ No newline at end of file +} diff --git a/config/api.php b/config/api.php index 18bfb2254..d6e883600 100644 --- a/config/api.php +++ b/config/api.php @@ -1,6 +1,5 @@ isSuccessful() && ! $response->isRedirection()) { throw new InternalHttpException($response); - } elseif (! $this->raw) { + } + + if (! $this->raw) { $response = $response->getOriginalContent(); } } catch (HttpExceptionInterface $exception) { diff --git a/src/Http/Middleware/Request.php b/src/Http/Middleware/Request.php index aa9faf33a..f1422f296 100644 --- a/src/Http/Middleware/Request.php +++ b/src/Http/Middleware/Request.php @@ -122,7 +122,7 @@ protected function sendRequestThroughRouter(HttpRequest $request) { $this->app->instance('request', $request); - return (new Pipeline($this->app))->send($request)->through($this->middleware)->then(function ($request) { + return (new Pipeline($this->app))->send($request)->then(function ($request) { return $this->router->dispatch($request); }); } diff --git a/src/Routing/Adapter/Lumen.php b/src/Routing/Adapter/Lumen.php index 1fa1eabba..7055fba85 100644 --- a/src/Routing/Adapter/Lumen.php +++ b/src/Routing/Adapter/Lumen.php @@ -51,6 +51,20 @@ class Lumen implements Adapter */ protected $routes = []; + /** + * Array of merged old routes and API routes. + * + * @var array + */ + protected $mergedRoutes = []; + + /** + * Routes already defined on the router. + * + * @var \Illuminate\Routing\RouteCollection + */ + protected $oldRoutes; + /** * Indicates if the middleware has been removed from the application instance. * @@ -92,7 +106,7 @@ public function dispatch(Request $request, $version) $this->removeMiddlewareFromApp(); - $routeCollector = $this->routes[$version]; + $routeCollector = $this->mergeOldRoutes($version); $dispatcher = call_user_func($this->dispatcherResolver, $routeCollector); $this->app->setDispatcher($dispatcher); @@ -102,6 +116,28 @@ public function dispatch(Request $request, $version) return $this->app->dispatch($request); } + /** + * Merge the old application routes with the API routes. + * + * @param string $version + * + * @return array + */ + protected function mergeOldRoutes($version) + { + if (! isset($this->oldRoutes)) { + $this->oldRoutes = $this->app->router->getRoutes(); + } + if (! isset($this->mergedRoutes[$version])) { + $this->mergedRoutes[$version] = $this->routes[$version]; + foreach ($this->oldRoutes as $route) { + $this->mergedRoutes[$version]->addRoute($route['method'], $route['uri'], $route['action']); + } + } + + return $this->mergedRoutes[$version]; + } + /** * Normalize the request URI so that Lumen can properly dispatch it. * @@ -225,9 +261,14 @@ protected function removeMiddlewareFromApp() $reflection = new ReflectionClass($this->app); $property = $reflection->getProperty('middleware'); $property->setAccessible(true); - - $property->setValue($this->app, []); - + $oldMiddlewares = $property->getValue($this->app); + $newMiddlewares = []; + foreach ($oldMiddlewares as $middle) { + if ((new ReflectionClass($middle))->hasMethod('terminate') && $middle != 'Dingo\Api\Http\Middleware\Request') { + $newMiddlewares = array_merge($newMiddlewares, [$middle]); + } + } + $property->setValue($this->app, $newMiddlewares); $property->setAccessible(false); } diff --git a/tests/Auth/AuthTest.php b/tests/Auth/AuthTest.php index dc6fc7a8a..b19340f3a 100644 --- a/tests/Auth/AuthTest.php +++ b/tests/Auth/AuthTest.php @@ -7,13 +7,13 @@ use Dingo\Api\Http\Request; use Dingo\Api\Routing\Route; use Dingo\Api\Routing\Router; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; use Dingo\Api\Contract\Auth\Provider; use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; -class AuthTest extends PHPUnit_Framework_TestCase +class AuthTest extends TestCase { public function setUp() { diff --git a/tests/Auth/Provider/AuthorizationTest.php b/tests/Auth/Provider/AuthorizationTest.php index c023eecd4..47de16f0a 100644 --- a/tests/Auth/Provider/AuthorizationTest.php +++ b/tests/Auth/Provider/AuthorizationTest.php @@ -5,10 +5,10 @@ use Mockery as m; use Dingo\Api\Routing\Route; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Tests\Stubs\AuthorizationProviderStub; -class AuthorizationTest extends PHPUnit_Framework_TestCase +class AuthorizationTest extends TestCase { public function tearDown() { diff --git a/tests/Auth/Provider/BasicTest.php b/tests/Auth/Provider/BasicTest.php index 1b3723e07..4de8325b0 100644 --- a/tests/Auth/Provider/BasicTest.php +++ b/tests/Auth/Provider/BasicTest.php @@ -5,10 +5,10 @@ use Mockery as m; use Illuminate\Http\Request; use Illuminate\Http\Response; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Auth\Provider\Basic; -class BasicTest extends PHPUnit_Framework_TestCase +class BasicTest extends TestCase { protected $auth; protected $provider; diff --git a/tests/Auth/Provider/JWTTest.php b/tests/Auth/Provider/JWTTest.php index 26875bbf5..0fd58a2a2 100644 --- a/tests/Auth/Provider/JWTTest.php +++ b/tests/Auth/Provider/JWTTest.php @@ -4,11 +4,11 @@ use Mockery as m; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Auth\Provider\JWT; use Tymon\JWTAuth\Exceptions\JWTException; -class JWTTest extends PHPUnit_Framework_TestCase +class JWTTest extends TestCase { protected $auth; protected $provider; diff --git a/tests/DispatcherTest.php b/tests/DispatcherTest.php index 4ccaad4bf..8f362f205 100644 --- a/tests/DispatcherTest.php +++ b/tests/DispatcherTest.php @@ -8,7 +8,7 @@ use Dingo\Api\Dispatcher; use Illuminate\Http\Request; use Dingo\Api\Routing\Router; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Tests\Stubs\UserStub; use Illuminate\Container\Container; use Illuminate\Filesystem\Filesystem; @@ -21,7 +21,7 @@ use Dingo\Api\Transformer\Factory as TransformerFactory; use Illuminate\Support\Facades\Request as RequestFacade; -class DispatcherTest extends PHPUnit_Framework_TestCase +class DispatcherTest extends TestCase { protected $container; @@ -154,7 +154,7 @@ public function testInternalExceptionContainsResponseObject() try { $this->dispatcher->get('test'); } catch (InternalHttpException $exception) { - $this->assertInstanceOf('Illuminate\Http\Response', $exception->getResponse()); + $this->assertInstanceOf(\Illuminate\Http\Response::class, $exception->getResponse()); $this->assertSame('test', $exception->getResponse()->getContent()); } } @@ -381,7 +381,7 @@ public function testRedirectResponseThrowsException() }); $response = $this->dispatcher->get('redirect'); - $this->assertInstanceOf('Illuminate\Http\RedirectResponse', $response); + $this->assertInstanceOf(\Illuminate\Http\RedirectResponse::class, $response); $this->assertSame('redirect-test', $response->getTargetUrl()); } diff --git a/tests/Exception/HandlerTest.php b/tests/Exception/HandlerTest.php index ed6d07c15..c38e64667 100644 --- a/tests/Exception/HandlerTest.php +++ b/tests/Exception/HandlerTest.php @@ -5,7 +5,7 @@ use Mockery as m; use RuntimeException; use Illuminate\Http\Response; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Exception\Handler; use Illuminate\Http\JsonResponse; use Illuminate\Http\RedirectResponse; @@ -13,7 +13,7 @@ use Dingo\Api\Exception\ResourceException; use Symfony\Component\HttpKernel\Exception\HttpException; -class HandlerTest extends PHPUnit_Framework_TestCase +class HandlerTest extends TestCase { protected $parentHandler; protected $exceptionHandler; @@ -67,7 +67,7 @@ public function testExceptionHandlerHandlesExceptionAndCreatesNewResponse() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\Response', $response); + $this->assertInstanceOf(Response::class, $response); $this->assertSame('foo', $response->getContent()); $this->assertSame(404, $response->getStatusCode()); } @@ -82,7 +82,7 @@ public function testExceptionHandlerHandlesExceptionWithRedirectResponse() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\RedirectResponse', $response); + $this->assertInstanceOf(RedirectResponse::class, $response); $this->assertSame('foo', $response->getTargetUrl()); $this->assertSame(302, $response->getStatusCode()); } @@ -97,7 +97,7 @@ public function testExceptionHandlerHandlesExceptionWithJsonResponse() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\JsonResponse', $response); + $this->assertInstanceOf(JsonResponse::class, $response); $this->assertSame('{"foo":"bar"}', $response->getContent()); $this->assertSame(404, $response->getStatusCode()); } @@ -108,7 +108,7 @@ public function testExceptionHandlerReturnsGenericWhenNoMatchingHandler() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\Response', $response); + $this->assertInstanceOf(Response::class, $response); $this->assertSame('{"message":"bar","status_code":404}', $response->getContent()); $this->assertSame(404, $response->getStatusCode()); } @@ -129,7 +129,7 @@ public function testUsingMultidimensionalArrayForGenericResponse() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\Response', $response); + $this->assertInstanceOf(Response::class, $response); $this->assertSame('{"error":{"message":"bar","status_code":404}}', $response->getContent()); $this->assertSame(404, $response->getStatusCode()); } @@ -150,7 +150,7 @@ public function testResourceExceptionErrorsAreIncludedInResponse() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\Response', $response); + $this->assertInstanceOf(Response::class, $response); $this->assertSame('{"message":"bar","errors":{"foo":["bar"]},"code":10,"status_code":422}', $response->getContent()); $this->assertSame(422, $response->getStatusCode()); } @@ -174,7 +174,7 @@ public function testHttpExceptionsWithNoMessageUseStatusCodeMessage() $response = $this->exceptionHandler->handle($exception); - $this->assertInstanceOf('Illuminate\Http\Response', $response); + $this->assertInstanceOf(Response::class, $response); $this->assertSame('{"message":"404 Not Found","status_code":404}', $response->getContent()); $this->assertSame(404, $response->getStatusCode()); } diff --git a/tests/Http/Middleware/AuthTest.php b/tests/Http/Middleware/AuthTest.php index 2199eea71..20076514a 100644 --- a/tests/Http/Middleware/AuthTest.php +++ b/tests/Http/Middleware/AuthTest.php @@ -7,14 +7,14 @@ use Dingo\Api\Http\Request; use Dingo\Api\Routing\Route; use Dingo\Api\Routing\Router; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; use Dingo\Api\Tests\Stubs\RoutingAdapterStub; use Illuminate\Routing\Route as IlluminateRoute; use Dingo\Api\Http\Middleware\Auth as AuthMiddleware; use Symfony\Component\HttpKernel\Exception\UnauthorizedHttpException; -class AuthTest extends PHPUnit_Framework_TestCase +class AuthTest extends TestCase { protected $container; protected $adapter; diff --git a/tests/Http/Middleware/RateLimitTest.php b/tests/Http/Middleware/RateLimitTest.php index 2e1e65f10..bc30cd9e8 100644 --- a/tests/Http/Middleware/RateLimitTest.php +++ b/tests/Http/Middleware/RateLimitTest.php @@ -7,7 +7,7 @@ use Dingo\Api\Http\Response; use Dingo\Api\Routing\Route; use Dingo\Api\Routing\Router; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Cache\CacheManager; use Dingo\Api\Http\InternalRequest; use Illuminate\Container\Container; @@ -17,7 +17,7 @@ use Dingo\Api\Exception\RateLimitExceededException; use Symfony\Component\HttpKernel\Exception\HttpException; -class RateLimitTest extends PHPUnit_Framework_TestCase +class RateLimitTest extends TestCase { protected $container; protected $router; diff --git a/tests/Http/Middleware/RequestTest.php b/tests/Http/Middleware/RequestTest.php index fda6ab4ea..7f10b0baf 100644 --- a/tests/Http/Middleware/RequestTest.php +++ b/tests/Http/Middleware/RequestTest.php @@ -6,7 +6,7 @@ use Dingo\Api\Http\Request; use Dingo\Api\Routing\Router; use Dingo\Api\Http\Validation; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Exception\Handler; use Dingo\Api\Http\RequestValidator; use Dingo\Api\Http\Validation\Accept; @@ -19,7 +19,7 @@ use Dingo\Api\Contract\Http\Request as RequestContract; use Dingo\Api\Http\Middleware\Request as RequestMiddleware; -class RequestTest extends PHPUnit_Framework_TestCase +class RequestTest extends TestCase { protected $app; protected $router; diff --git a/tests/Http/Parser/AcceptTest.php b/tests/Http/Parser/AcceptTest.php index a8ca10490..268995ad8 100644 --- a/tests/Http/Parser/AcceptTest.php +++ b/tests/Http/Parser/AcceptTest.php @@ -3,10 +3,10 @@ namespace Dingo\Api\Tests\Http\Parser; use Dingo\Api\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Http\Parser\Accept; -class AcceptTest extends PHPUnit_Framework_TestCase +class AcceptTest extends TestCase { public function testParsingInvalidAcceptReturnsDefaults() { diff --git a/tests/Http/RateLimit/HandlerTest.php b/tests/Http/RateLimit/HandlerTest.php index c703c9ba2..e2a57d01d 100644 --- a/tests/Http/RateLimit/HandlerTest.php +++ b/tests/Http/RateLimit/HandlerTest.php @@ -3,14 +3,14 @@ namespace Dingo\Api\Tests\Http\RateLimit; use Dingo\Api\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Cache\CacheManager; use Illuminate\Container\Container; use Dingo\Api\Http\RateLimit\Handler; use Dingo\Api\Tests\Stubs\ThrottleStub; use Dingo\Api\Http\RateLimit\Throttle\Route; -class HandlerTest extends PHPUnit_Framework_TestCase +class HandlerTest extends TestCase { protected $container; protected $cache; diff --git a/tests/Http/RateLimit/Throttle/AuthenticatedTest.php b/tests/Http/RateLimit/Throttle/AuthenticatedTest.php index 006cf805a..1112b5bf7 100644 --- a/tests/Http/RateLimit/Throttle/AuthenticatedTest.php +++ b/tests/Http/RateLimit/Throttle/AuthenticatedTest.php @@ -4,11 +4,11 @@ use Mockery; use Dingo\Api\Auth\Auth; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; use Dingo\Api\Http\RateLimit\Throttle\Authenticated; -class AuthenticatedTest extends PHPUnit_Framework_TestCase +class AuthenticatedTest extends TestCase { public function testThrottleMatchesCorrectly() { diff --git a/tests/Http/RateLimit/Throttle/UnauthenticatedTest.php b/tests/Http/RateLimit/Throttle/UnauthenticatedTest.php index 6da8ce1b8..a90cef843 100644 --- a/tests/Http/RateLimit/Throttle/UnauthenticatedTest.php +++ b/tests/Http/RateLimit/Throttle/UnauthenticatedTest.php @@ -4,11 +4,11 @@ use Mockery; use Dingo\Api\Auth\Auth; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; use Dingo\Api\Http\RateLimit\Throttle\Unauthenticated; -class UnauthenticatedTest extends PHPUnit_Framework_TestCase +class UnauthenticatedTest extends TestCase { public function testThrottleMatchesCorrectly() { diff --git a/tests/Http/RequestValidatorTest.php b/tests/Http/RequestValidatorTest.php index aaedd31de..a7043c94a 100644 --- a/tests/Http/RequestValidatorTest.php +++ b/tests/Http/RequestValidatorTest.php @@ -3,13 +3,13 @@ namespace Dingo\Api\Tests\Http; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; use Dingo\Api\Http\RequestValidator; use Dingo\Api\Tests\Stubs\HttpValidatorStub; use Dingo\Api\Http\Parser\Accept as AcceptParser; -class RequestValidatorTest extends PHPUnit_Framework_TestCase +class RequestValidatorTest extends TestCase { protected $container; diff --git a/tests/Http/Response/FactoryTest.php b/tests/Http/Response/FactoryTest.php index 432f140e7..909022146 100644 --- a/tests/Http/Response/FactoryTest.php +++ b/tests/Http/Response/FactoryTest.php @@ -3,14 +3,14 @@ namespace Dingo\Api\Tests\Http\Response; use Mockery; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Support\Collection; use Dingo\Api\Tests\Stubs\UserStub; use Dingo\Api\Http\Response\Factory; use Illuminate\Pagination\Paginator; use Dingo\Api\Transformer\Factory as TransformerFactory; -class FactoryTest extends PHPUnit_Framework_TestCase +class FactoryTest extends TestCase { protected $transformer; protected $factory; @@ -86,13 +86,13 @@ public function testMakingCollectionResponseWithThreeParameters() return $param instanceof \Closure; })); - $this->assertInstanceOf('Illuminate\Support\Collection', $this->factory->collection(new Collection([new UserStub('Jason')]), 'test', function ($resource, $fractal) { - $this->assertInstanceOf('League\Fractal\Resource\Collection', $resource); - $this->assertInstanceOf('League\Fractal\Manager', $fractal); + $this->assertInstanceOf(Collection::class, $this->factory->collection(new Collection([new UserStub('Jason')]), 'test', function ($resource, $fractal) { + $this->assertInstanceOf(\League\Fractal\Resource\Collection::class, $resource); + $this->assertInstanceOf(\League\Fractal\Manager::class, $fractal); })->getOriginalContent()); - $this->assertInstanceOf('Illuminate\Support\Collection', $this->factory->withCollection(new Collection([new UserStub('Jason')]), 'test', function ($resource, $fractal) { - $this->assertInstanceOf('League\Fractal\Resource\Collection', $resource); - $this->assertInstanceOf('League\Fractal\Manager', $fractal); + $this->assertInstanceOf(Collection::class, $this->factory->withCollection(new Collection([new UserStub('Jason')]), 'test', function ($resource, $fractal) { + $this->assertInstanceOf(\League\Fractal\Resource\Collection::class, $resource); + $this->assertInstanceOf(\League\Fractal\Manager::class, $fractal); })->getOriginalContent()); } @@ -111,12 +111,12 @@ public function testMakingItemResponseWithThreeParameters() })); $this->assertInstanceOf(\Dingo\Api\Tests\Stubs\UserStub::class, $this->factory->item(new UserStub('Jason'), 'test', function ($resource, $fractal) { - $this->assertInstanceOf('League\Fractal\Resource\Item', $resource); - $this->assertInstanceOf('League\Fractal\Manager', $fractal); + $this->assertInstanceOf(\League\Fractal\Resource\Item::class, $resource); + $this->assertInstanceOf(\League\Fractal\Manager::class, $fractal); })->getOriginalContent()); $this->assertInstanceOf(\Dingo\Api\Tests\Stubs\UserStub::class, $this->factory->withItem(new UserStub('Jason'), 'test', function ($resource, $fractal) { - $this->assertInstanceOf('League\Fractal\Resource\Item', $resource); - $this->assertInstanceOf('League\Fractal\Manager', $fractal); + $this->assertInstanceOf(\League\Fractal\Resource\Item::class, $resource); + $this->assertInstanceOf(\League\Fractal\Manager::class, $fractal); })->getOriginalContent()); } diff --git a/tests/Http/Response/Format/JsonTest.php b/tests/Http/Response/Format/JsonTest.php index 3820347d9..47655d9f3 100644 --- a/tests/Http/Response/Format/JsonTest.php +++ b/tests/Http/Response/Format/JsonTest.php @@ -4,13 +4,13 @@ use Mockery; use Dingo\Api\Http\Response; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Support\MessageBag; use Dingo\Api\Http\Response\Format\Json; use Dingo\Api\Tests\Stubs\EloquentModelStub; use Illuminate\Database\Eloquent\Collection; -class JsonTest extends PHPUnit_Framework_TestCase +class JsonTest extends TestCase { public function setUp() { diff --git a/tests/Http/Response/Format/JsonpTest.php b/tests/Http/Response/Format/JsonpTest.php index 5dcb5c828..07802dad7 100644 --- a/tests/Http/Response/Format/JsonpTest.php +++ b/tests/Http/Response/Format/JsonpTest.php @@ -5,13 +5,13 @@ use Mockery; use Dingo\Api\Http\Response; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Support\MessageBag; use Dingo\Api\Http\Response\Format\Jsonp; use Dingo\Api\Tests\Stubs\EloquentModelStub; use Illuminate\Database\Eloquent\Collection; -class JsonpTest extends PHPUnit_Framework_TestCase +class JsonpTest extends TestCase { public function setUp() { diff --git a/tests/Http/ResponseTest.php b/tests/Http/ResponseTest.php index 89ec3abd6..2efd8966d 100644 --- a/tests/Http/ResponseTest.php +++ b/tests/Http/ResponseTest.php @@ -5,7 +5,7 @@ use StdClass; use Mockery as m; use Dingo\Api\Http\Response; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Transformer\Binding; use Illuminate\Container\Container; use Dingo\Api\Event\ResponseIsMorphing; @@ -13,7 +13,7 @@ use Dingo\Api\Http\Response\Format\Json; use Illuminate\Events\Dispatcher as EventDispatcher; -class ResponseTest extends PHPUnit_Framework_TestCase +class ResponseTest extends TestCase { public function setUp() { diff --git a/tests/Http/Validation/AcceptTest.php b/tests/Http/Validation/AcceptTest.php index ebbc6fbad..0a0610748 100644 --- a/tests/Http/Validation/AcceptTest.php +++ b/tests/Http/Validation/AcceptTest.php @@ -3,11 +3,11 @@ namespace Dingo\Api\Tests\Http\Validation; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Http\Parser\Accept as AcceptParser; use Dingo\Api\Http\Validation\Accept as AcceptValidator; -class AcceptTest extends PHPUnit_Framework_TestCase +class AcceptTest extends TestCase { public function testValidationPassesForStrictModeAndOptionsRequests() { diff --git a/tests/Http/Validation/DomainTest.php b/tests/Http/Validation/DomainTest.php index 867474705..ebdefddcd 100644 --- a/tests/Http/Validation/DomainTest.php +++ b/tests/Http/Validation/DomainTest.php @@ -3,10 +3,10 @@ namespace Dingo\Api\Tests\Http\Validation; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Http\Validation\Domain; -class DomainTest extends PHPUnit_Framework_TestCase +class DomainTest extends TestCase { public function testValidationFailsWithInvalidOrNullDomain() { diff --git a/tests/Http/Validation/PrefixTest.php b/tests/Http/Validation/PrefixTest.php index e85a1719d..b4147bd90 100644 --- a/tests/Http/Validation/PrefixTest.php +++ b/tests/Http/Validation/PrefixTest.php @@ -3,10 +3,10 @@ namespace Dingo\Api\Tests\Http\Validation; use Illuminate\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Http\Validation\Prefix; -class PrefixTest extends PHPUnit_Framework_TestCase +class PrefixTest extends TestCase { public function testValidationFailsWithInvalidOrNullPrefix() { diff --git a/tests/Routing/Adapter/BaseAdapterTest.php b/tests/Routing/Adapter/BaseAdapterTest.php index 59ebaf3cd..6db66cf5d 100644 --- a/tests/Routing/Adapter/BaseAdapterTest.php +++ b/tests/Routing/Adapter/BaseAdapterTest.php @@ -5,10 +5,10 @@ use Mockery as m; use Dingo\Api\Http; use Dingo\Api\Routing\Router; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Tests\Stubs\MiddlewareStub; -abstract class BaseAdapterTest extends PHPUnit_Framework_TestCase +abstract class BaseAdapterTest extends TestCase { protected $container; protected $adapter; diff --git a/tests/Routing/RouteTest.php b/tests/Routing/RouteTest.php index e32edf32a..dbd0b6ec0 100644 --- a/tests/Routing/RouteTest.php +++ b/tests/Routing/RouteTest.php @@ -5,12 +5,12 @@ use Mockery as m; use Dingo\Api\Http\Request; use Dingo\Api\Routing\Route; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Container\Container; use Dingo\Api\Tests\Stubs\RoutingAdapterStub; use Illuminate\Routing\Route as IlluminateRoute; -class RouteTest extends PHPUnit_Framework_TestCase +class RouteTest extends TestCase { protected $adapter; protected $container; diff --git a/tests/Transformer/Adapter/FractalTest.php b/tests/Transformer/Adapter/FractalTest.php index a2c6765ab..90fe50aac 100644 --- a/tests/Transformer/Adapter/FractalTest.php +++ b/tests/Transformer/Adapter/FractalTest.php @@ -3,11 +3,11 @@ namespace Dingo\Api\Tests\Transformer\Adapter; use Dingo\Api\Http\Request; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Transformer\Adapter\Fractal; use League\Fractal\Manager as FractalManager; -class FractalTest extends PHPUnit_Framework_TestCase +class FractalTest extends TestCase { protected $fractal; diff --git a/tests/Transformer/FactoryTest.php b/tests/Transformer/FactoryTest.php index 9ae9d1793..df1cef9ef 100644 --- a/tests/Transformer/FactoryTest.php +++ b/tests/Transformer/FactoryTest.php @@ -3,7 +3,7 @@ namespace Dingo\Api\Tests\Transformer; use Mockery; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Dingo\Api\Transformer\Factory; use Illuminate\Support\Collection; use Dingo\Api\Tests\Stubs\UserStub; @@ -11,7 +11,7 @@ use Dingo\Api\Tests\Stubs\TransformerStub; use Dingo\Api\Tests\Stubs\UserTransformerStub; -class FactoryTest extends PHPUnit_Framework_TestCase +class FactoryTest extends TestCase { protected $factory;