From ae8d41d9334958d1d467715bb658259f2fe1d2de Mon Sep 17 00:00:00 2001 From: Marcel Thole Date: Sat, 24 Oct 2020 15:33:51 +0200 Subject: [PATCH] Bump dependencies to PHP8 Signed-off-by: Marcel Thole --- .travis.yml | 14 +++++++----- composer.json | 6 ++--- test/ExceptionTest.php | 2 +- test/FastRouteRouter/ConfigProviderTest.php | 8 +++---- test/FastRouteRouterFactoryTest.php | 25 ++++++++++++++++----- test/FastRouteRouterTest.php | 14 +++++++++--- test/ImplicitMethodsIntegrationTest.php | 2 +- test/UriGeneratorTest.php | 2 +- 8 files changed, 49 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 10dded4..4a2dfe8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,25 +12,27 @@ env: matrix: fast_finish: true include: - - php: 7.1 + - php: 7.3 env: - DEPS=lowest - - php: 7.1 + - php: 7.3 env: - DEPS=latest - CS_CHECK=true - TEST_COVERAGE=true - - php: 7.2 + - php: 7.4 env: - DEPS=lowest - - php: 7.2 + - php: 7.4 env: - DEPS=latest - - php: 7.3 + - php: nightly env: + - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" - DEPS=lowest - - php: 7.3 + - php: nightly env: + - COMPOSER_ARGS="--no-interaction --ignore-platform-reqs" - DEPS=latest before_install: diff --git a/composer.json b/composer.json index 086be0a..2c8eb58 100644 --- a/composer.json +++ b/composer.json @@ -29,11 +29,11 @@ } }, "require": { - "php": "^7.1", + "php": "^7.3 || ~8.0.0", "fig/http-message-util": "^1.1.2", "laminas/laminas-stdlib": "^2.0 || ^3.1", "laminas/laminas-zendframework-bridge": "^1.0", - "mezzio/mezzio-router": "^3.0", + "mezzio/mezzio-router": "^3.2", "nikic/fast-route": "^1.2", "psr/container": "^1.0", "psr/http-message": "^1.0.1" @@ -44,7 +44,7 @@ "laminas/laminas-stratigility": "^3.0", "malukenho/docheader": "^0.1.6", "mikey179/vfsstream": "^1.6.7", - "phpunit/phpunit": "^7.0.2" + "phpunit/phpunit": "^9.4.1" }, "conflict": { "container-interop/container-interop": "<1.2.0" diff --git a/test/ExceptionTest.php b/test/ExceptionTest.php index f0d78b8..d9824c0 100644 --- a/test/ExceptionTest.php +++ b/test/ExceptionTest.php @@ -39,7 +39,7 @@ public function exception() : Generator */ public function testExceptionIsInstanceOfExceptionInterface(string $exception) : void { - self::assertContains('Exception', $exception); + self::assertStringContainsString('Exception', $exception); self::assertTrue(is_a($exception, ExceptionInterface::class, true)); } } diff --git a/test/FastRouteRouter/ConfigProviderTest.php b/test/FastRouteRouter/ConfigProviderTest.php index b293680..3eee19e 100644 --- a/test/FastRouteRouter/ConfigProviderTest.php +++ b/test/FastRouteRouter/ConfigProviderTest.php @@ -30,7 +30,7 @@ protected function setUp() : void public function testInvocationReturnsArray() : array { $config = ($this->provider)(); - $this->assertInternalType('array', $config); + $this->assertIsArray($config); return $config; } @@ -41,14 +41,14 @@ public function testInvocationReturnsArray() : array public function testReturnedArrayContainsDependencies(array $config) : void { $this->assertArrayHasKey('dependencies', $config); - $this->assertInternalType('array', $config['dependencies']); + $this->assertIsArray($config['dependencies']); $this->assertArrayHasKey('aliases', $config['dependencies']); - $this->assertInternalType('array', $config['dependencies']['aliases']); + $this->assertIsArray($config['dependencies']['aliases']); $this->assertArrayHasKey(RouterInterface::class, $config['dependencies']['aliases']); $this->assertArrayHasKey('factories', $config['dependencies']); - $this->assertInternalType('array', $config['dependencies']['factories']); + $this->assertIsArray($config['dependencies']['factories']); $this->assertArrayHasKey(FastRouteRouter::class, $config['dependencies']['factories']); } } diff --git a/test/FastRouteRouterFactoryTest.php b/test/FastRouteRouterFactoryTest.php index 16f1232..bf662fd 100644 --- a/test/FastRouteRouterFactoryTest.php +++ b/test/FastRouteRouterFactoryTest.php @@ -22,7 +22,7 @@ class FastRouteRouterFactoryTest extends TestCase private $container; - protected function setUp() + protected function setUp(): void { $this->factory = new FastRouteRouterFactory(); $this->container = $this->prophesize(ContainerInterface::class); @@ -35,8 +35,15 @@ public function testCreatesRouterWithEmptyConfig() $router = ($this->factory)($this->container->reveal()); $this->assertInstanceOf(FastRouteRouter::class, $router); - $this->assertAttributeSame(false, 'cacheEnabled', $router); - $this->assertAttributeSame('data/cache/fastroute.php.cache', 'cacheFile', $router); + $cacheEnabled = \Closure::bind(function () { + return $this->cacheEnabled; + }, $router, FastRouteRouter::class)(); + $this->assertFalse($cacheEnabled); + + $cacheFile = \Closure::bind(function () { + return $this->cacheFile; + }, $router, FastRouteRouter::class)(); + $this->assertSame('data/cache/fastroute.php.cache', $cacheFile); } public function testCreatesRouterWithConfig() @@ -54,7 +61,15 @@ public function testCreatesRouterWithConfig() $router = ($this->factory)($this->container->reveal()); $this->assertInstanceOf(FastRouteRouter::class, $router); - $this->assertAttributeSame(true, 'cacheEnabled', $router); - $this->assertAttributeSame('/foo/bar/file-cache', 'cacheFile', $router); + + $cacheEnabled = \Closure::bind(function () { + return $this->cacheEnabled; + }, $router, FastRouteRouter::class)(); + $this->assertTrue($cacheEnabled); + + $cacheFile = \Closure::bind(function () { + return $this->cacheFile; + }, $router, FastRouteRouter::class)(); + $this->assertSame('/foo/bar/file-cache', $cacheFile); } } diff --git a/test/FastRouteRouterTest.php b/test/FastRouteRouterTest.php index 9d2e58a..a421d9e 100644 --- a/test/FastRouteRouterTest.php +++ b/test/FastRouteRouterTest.php @@ -48,7 +48,7 @@ class FastRouteRouterTest extends TestCase */ private $dispatchCallback; - protected function setUp() + protected function setUp(): void { $this->fastRouter = $this->prophesize(RouteCollector::class); $this->dispatcher = $this->prophesize(Dispatcher::class); @@ -73,7 +73,11 @@ private function getMiddleware() : MiddlewareInterface public function testWillLazyInstantiateAFastRouteCollectorIfNoneIsProvidedToConstructor() { $router = new FastRouteRouter(); - $this->assertAttributeInstanceOf(RouteCollector::class, 'router', $router); + $routeCollector = \Closure::bind(function () { + return $this->router; + }, $router, FastRouteRouter::class)(); + + $this->assertInstanceOf(RouteCollector::class, $routeCollector); } public function testAddingRouteAggregatesRoute() @@ -81,7 +85,11 @@ public function testAddingRouteAggregatesRoute() $route = new Route('/foo', $this->getMiddleware(), [RequestMethod::METHOD_GET]); $router = $this->getRouter(); $router->addRoute($route); - $this->assertAttributeContains($route, 'routesToInject', $router); + + $routesToInject = \Closure::bind(function () { + return $this->routesToInject; + }, $router, FastRouteRouter::class)(); + $this->assertContains($route, $routesToInject); } /** diff --git a/test/ImplicitMethodsIntegrationTest.php b/test/ImplicitMethodsIntegrationTest.php index 0905de6..296ba43 100644 --- a/test/ImplicitMethodsIntegrationTest.php +++ b/test/ImplicitMethodsIntegrationTest.php @@ -13,7 +13,7 @@ use Generator; use Mezzio\Router\FastRouteRouter; use Mezzio\Router\RouterInterface; -use Mezzio\Router\Test\ImplicitMethodsIntegrationTest as RouterIntegrationTest; +use Mezzio\Router\Test\AbstractImplicitMethodsIntegrationTest as RouterIntegrationTest; class ImplicitMethodsIntegrationTest extends RouterIntegrationTest { diff --git a/test/UriGeneratorTest.php b/test/UriGeneratorTest.php index 8107d2b..a525ae7 100644 --- a/test/UriGeneratorTest.php +++ b/test/UriGeneratorTest.php @@ -124,7 +124,7 @@ public function provideRouteTests() ]; } - protected function setUp() + protected function setUp(): void { $this->fastRouter = $this->prophesize(RouteCollector::class); $this->dispatcher = $this->prophesize(Dispatcher::class);