Completed
Pull Request — master (#2)
by ARP
11:21 queued 05:17
created

anonymous//tests/AbstractMiddlewareTest.php$0   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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