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

4.x - Route InvocationStrategy Setter #2634

Merged
merged 5 commits into from Apr 20, 2019
Merged
Changes from 3 commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -22,6 +22,14 @@ interface RouteInterface
*/
public function getInvocationStrategy(): InvocationStrategyInterface;
/**
* Set route invocation strategy
*
* @param InvocationStrategyInterface $invocationStrategy
* @return RouteInterface
*/
public function setInvocationStrategy(InvocationStrategyInterface $invocationStrategy): RouteInterface;
/**
* Get route methods
*
@@ -165,6 +165,15 @@ public function getInvocationStrategy(): InvocationStrategyInterface
return $this->invocationStrategy;
}
/**
* {@inheritdoc}
*/
public function setInvocationStrategy(InvocationStrategyInterface $invocationStrategy): RouteInterface
{
$this->invocationStrategy = $invocationStrategy;
return $this;
}
/**
* {@inheritdoc}
*/
@@ -121,6 +121,22 @@ public function testGetInvocationStrategy()
$this->assertEquals($strategy, $route->getInvocationStrategy());
}
public function testSetInvocationStrategy()
{
$callable = function (ServerRequestInterface $request, ResponseInterface $response, $args) {
return $response;
};
$responseFactory = $this->getResponseFactory();
$callableResolver = new CallableResolver();
$strategy = new RequestResponse();
$route = new Route(['GET'], '/', $callable, $responseFactory, $callableResolver);
$route->setInvocationStrategy($strategy);
This conversation was marked as resolved by l0gicgate

This comment has been minimized.

Copy link
@akrabat

akrabat Apr 18, 2019

Member

If I comment out this line ($route->setInvocationStrategy($strategy);), the test still passes…

This comment has been minimized.

Copy link
@l0gicgate

l0gicgate Apr 18, 2019

Author Contributor

Just fixed the assertion to use assertSame() instead I messed up 😂

$this->assertEquals($strategy, $route->getInvocationStrategy());
}
public function testGetGroups()
{
$callable = function (ServerRequestInterface $request, ResponseInterface $response, $args) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.