Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Code Lines | 20 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
20 | public function testHttpRequestShouldBeSetOnPipeline() |
||
21 | { |
||
22 | $request = $this->createMock(ServerRequestInterface::class); |
||
23 | $response = $this->createMock(ResponseInterface::class); |
||
24 | $view = ViewFactory::create(); |
||
25 | |||
26 | $middleware = $this->createMock(MiddlewareInterface::class); |
||
27 | $middleware |
||
28 | ->expects($this->once()) |
||
29 | ->method('process') |
||
30 | ->with($this->equalTo($view), $this->equalTo($request)) |
||
31 | ->willReturn($view); |
||
32 | |||
33 | $pipeline = new Pipeline([$middleware]); |
||
34 | |||
35 | $handler = $this->createMock(RequestHandlerInterface::class); |
||
36 | $handler |
||
37 | ->expects($this->once()) |
||
38 | ->method('handle') |
||
39 | ->with($this->equalTo($request)) |
||
40 | ->will($this->returnCallback(function () use ($pipeline, $view, $response) { |
||
41 | $pipeline->process($view); |
||
42 | |||
43 | return $response; |
||
44 | })); |
||
45 | |||
46 | $httpMiddleware = new ShootMiddleware($pipeline); |
||
47 | $httpMiddleware->process($request, $handler); |
||
48 | } |
||
50 |