Passed
Push — master ( 72a485...d1319e )
by Woody
14:49 queued 05:56
created

()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
<?php
2
declare(strict_types=1);
3
4
namespace Northwoods\Middleware;
5
6
use Northwoods\Middleware\Fixture\Handler;
7
use Nyholm\Psr7\ServerRequest;
8
use PHPUnit\Framework\TestCase;
9
use Psr\Container\ContainerInterface;
10
11
class LazyHandlerTest extends TestCase
12
{
13
    /** @var ContainerInterface */
14
    private $container;
0 ignored issues
show
Coding Style introduced by
Private member variable "container" must contain a leading underscore
Loading history...
Coding Style introduced by
Expected 1 blank line before member var; 0 found
Loading history...
15
16
    public function setUp()
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 1 found
Loading history...
17
    {
18
        $this->container = new class implements ContainerInterface
19
        {
20
            public function has($id)
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines before function; 0 found
Loading history...
21
            {
22
                return class_exists($id);
23
            }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
24
25
            public function get($id)
26
            {
27
                return new $id();
28
            }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
29
        };
30
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
31
32
    public function testDefersToHandlerImplemention(): void
33
    {
34
        $handler = new LazyHandler($this->container, Handler::class);
35
36
        $request = new ServerRequest('GET', 'https://example.com/');
37
38
        $response = $handler->handle($request);
39
40
        $this->assertEquals(400, $response->getStatusCode());
41
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
42
}
43