Skip to content

Commit

Permalink
Fix tests across versions
Browse files Browse the repository at this point in the history
  • Loading branch information
philipobenito committed Jan 25, 2021
1 parent 3cece67 commit bb97a32
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"phpunit/phpunit" : "^7.0",
"phpunit/phpunit" : "^7.5",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"roave/security-advisories": "dev-master",
Expand Down
6 changes: 3 additions & 3 deletions tests/RouteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function testRouteSetsAndResolvesInvokableClassCallable(): void
{
$callable = new Controller;
$route = new Route('GET', '/', $callable);
$this->assertInternalType('callable', $route->getCallable());
$this->assertIsCallable($route->getCallable());
}

/**
Expand All @@ -32,7 +32,7 @@ public function testRouteSetsAndResolvesClassMethodCallable(): void
{
$callable = [new Controller, 'action'];
$route = new Route('GET', '/', $callable);
$this->assertInternalType('callable', $route->getCallable());
$this->assertIsCallable($route->getCallable());
}

/**
Expand All @@ -44,7 +44,7 @@ public function testRouteSetsAndResolvesNamedFunctionCallable(): void
{
$callable = 'League\Route\Fixture\namedFunctionCallable';
$route = new Route('GET', '/', $callable);
$this->assertInternalType('callable', $route->getCallable());
$this->assertIsCallable($route->getCallable());
}

/**
Expand Down
6 changes: 5 additions & 1 deletion tests/RouterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ public function testNewPatternMatchesCanBeAddedAtRuntime(): void
{
$router = new Router;
$router->addPatternMatcher('mockMatcher', '[a-zA-Z]');
$matchers = $this->getObjectAttribute($router, 'patternMatchers');

$reflectionClass = new \ReflectionClass($router);
$reflectionProperty = $reflectionClass->getProperty('patternMatchers');
$reflectionProperty->setAccessible(true);
$matchers = $reflectionProperty->getValue($router);

$this->assertArrayHasKey('/{(.+?):mockMatcher}/', $matchers);
$this->assertEquals('{$1:[a-zA-Z]}', $matchers['/{(.+?):mockMatcher}/']);
Expand Down

0 comments on commit bb97a32

Please sign in to comment.