Passed
Push — master ( da738a...72a485 )
by Woody
40s
created

LazyHandlerFactoryTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 28
rs 10
c 0
b 0
f 0
wmc 4

6 Methods

Rating   Name   Duplication   Size   Complexity  
setUp() 0 16 ?
A hp$0 ➔ has() 0 3 1
testCreatesProxyHandler() 0 5 ?
A hp$0 ➔ setUp() 0 16 1
A hp$0 ➔ testCreatesProxyHandler() 0 5 1
A hp$0 ➔ get() 0 3 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Northwoods\Middleware;
5
6
use Northwoods\Middleware\Fixture\Handler;
7
use PHPUnit\Framework\TestCase;
8
use Psr\Container\ContainerInterface;
9
use Psr\Http\Server\RequestHandlerInterface;
10
11
class LazyHandlerFactoryTest extends TestCase
12
{
13
    /** @var LazyHandlerFactory */
14
    private $factory;
0 ignored issues
show
Coding Style introduced by
Private member variable "factory" 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
        $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
31
        $this->factory = new LazyHandlerFactory($container);
32
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 1 found
Loading history...
33
34
    public function testCreatesProxyHandler(): void
35
    {
36
        $handler = $this->factory->defer(Handler::class);
37
38
        $this->assertInstanceOf(RequestHandlerInterface::class, $handler);
39
    }
0 ignored issues
show
Coding Style introduced by
Expected 2 blank lines after function; 0 found
Loading history...
40
}
41