Passed
Pull Request — master (#1)
by David
02:31
created

AbstractMiddlewareTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A hp$0 ➔ process() 0 4 1
A getDelegate() 0 17 1
1
<?php
2
3
4
namespace TheCodingMachine\Middlewares;
5
6
7
use Interop\Http\ServerMiddleware\DelegateInterface;
8
use PHPUnit\Framework\TestCase;
9
use Psr\Http\Message\ServerRequestInterface;
10
use Zend\Diactoros\Response\TextResponse;
11
12
abstract class AbstractMiddlewareTest extends TestCase
13
{
14
    protected function getDelegate() : DelegateInterface
15
    {
16
        return new class implements DelegateInterface {
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 process(ServerRequestInterface $request)
26
            {
27
                return new TextResponse('foobar');
28
            }
29
        };
30
    }
31
}