Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dependencies to PHP8 #7

Merged
merged 1 commit into from
Dec 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion test/ExceptionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}
8 changes: 4 additions & 4 deletions test/FastRouteRouter/ConfigProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ protected function setUp() : void
public function testInvocationReturnsArray() : array
{
$config = ($this->provider)();
$this->assertInternalType('array', $config);
$this->assertIsArray($config);

return $config;
}
Expand All @@ -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']);
}
}
25 changes: 20 additions & 5 deletions test/FastRouteRouterFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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()
Expand All @@ -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);
}
}
14 changes: 11 additions & 3 deletions test/FastRouteRouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -73,15 +73,23 @@ 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()
{
$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);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/ImplicitMethodsIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion test/UriGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down