Completed
Push — master ( 3ec40e...da98e0 )
by David
01:14 queued 13s
created

AbstractMiddlewareTest.php$0 ➔ handle()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
4
namespace TheCodingMachine\Middlewares;
5
6
use PHPUnit\Framework\TestCase;
7
use Psr\Http\Message\ResponseInterface;
8
use Psr\Http\Message\ServerRequestInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
use Zend\Diactoros\Response\TextResponse;
11
12
abstract class AbstractMiddlewareTest extends TestCase
13
{
14
    protected function getDelegate() : RequestHandlerInterface
15
    {
16
        return new class implements RequestHandlerInterface {
17
18
            /**
19
             * Dispatch the next available middleware and return the response.
20
             *
21
             * @param ServerRequestInterface $request
22
             *
23
             * @return ResponseInterface
24
             */
25
            public function handle(ServerRequestInterface $request):ResponseInterface
26
            {
27
                return new TextResponse('foobar');
28
            }
29
        };
30
    }
31
}
32