$router =
$this->
createMock(RequestContextAwareInterface::
class);
$context =
new RequestContext('', 'POST', 'github.com'
);
$router ->
expects($this->
once()) ->
method('getContext'
) ->
willReturn($context);
$middleware =
new RouterContextMiddleware($router);
$envelope =
new Envelope(new \
stdClass(),
[ new ConsumedByWorkerStamp(),
new RouterContextStamp('', 'GET', 'symfony.com', 'https', 80, 443, '/', ''
),
]);
$nextMiddleware =
$this->
createMock(MiddlewareInterface::
class);
$nextMiddleware ->
expects($this->
once()) ->
method('handle'
) ->
willReturnCallback(function DEnvelope
$envelope, StackInterface
$stack) use ($context): Envelope
{ $this->
assertSame('symfony.com',
$context->
getHost());
return $envelope;
}) ;