Skip to content
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ All notable changes to this project will be documented in this file, in reverse

### Fixed

- [#10](https://github.com/mezzio/mezzio-cors/pull/10) Per-route `explicit` configuration is now properly handled.

- [#13](https://github.com/mezzio/mezzio-cors/pull/13) Added missing default value for `allowed_max_age` which fixes [#12](https://github.com/mezzio/mezzio-cors/issues/12)

## 1.0.1 - 2020-09-02
Expand Down
2 changes: 1 addition & 1 deletion src/Service/ConfigurationLocator.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private function configurationFromRoute(RouteResult $result): RouteConfiguration
->withRequestMethods($allowedMethods);
}

$routeParameters = ['explicit' => $explicit] + $routeParameters;
$routeParameters += ['explicit' => $explicit];

$routeConfiguration = $routeConfigurationFactory($routeParameters)
->withRequestMethods($allowedMethods);
Expand Down
9 changes: 8 additions & 1 deletion test/Service/ConfigurationLocatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -357,10 +357,16 @@ public function testWillEarlyReturnExplicitRouteConfiguration(): void
->method('isFailure')
->willReturn(false);

$routeConfigurationParameters = [
RouteConfigurationInterface::PARAMETER_IDENTIFIER => [
'explicit' => true,
],
];

$matchingExplicitRouteResult
->expects($this->once())
->method('getMatchedParams')
->willReturn([RouteConfigurationInterface::PARAMETER_IDENTIFIER => []]);
->willReturn($routeConfigurationParameters);

$matchingExplicitRouteResult
->expects($this->once())
Expand All @@ -382,6 +388,7 @@ public function testWillEarlyReturnExplicitRouteConfiguration(): void
$this->routeConfigurationFactory
->expects($this->any())
->method('__invoke')
->withConsecutive([], $routeConfigurationParameters)
->willReturn($routeConfiguration);

$routeConfiguration
Expand Down