FirewallMapFactoryTest::testCreate()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
c 0
b 0
f 0
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
namespace Symnedi\Security\Tests\Http;
4
5
use PHPUnit\Framework\TestCase;
6
use Symnedi\Security\Contract\Http\FirewallHandlerInterface;
7
use Symnedi\Security\Contract\Http\FirewallMapFactoryInterface;
8
use Symnedi\Security\Contract\Http\FirewallMapInterface;
9
use Symnedi\Security\Contract\HttpFoundation\RequestMatcherInterface;
10
use Symnedi\Security\Http\FirewallMapFactory;
11
12
final class FirewallMapFactoryTest extends TestCase
13
{
14
    public function testCreate()
15
    {
16
        $firewallMapFactory = $this->createLoadedFirewallMapFactory();
17
        $firewallMap = $firewallMapFactory->create();
18
        $this->assertInstanceOf(FirewallMapInterface::class, $firewallMap);
19
    }
20
21
    private function createLoadedFirewallMapFactory() : FirewallMapFactoryInterface
22
    {
23
        $firewallMapFactory = new FirewallMapFactory();
24
25
        $requestMatcherMock = $this->prophesize(RequestMatcherInterface::class);
26
        $requestMatcherMock->getFirewallName()->willReturn('someFirewall');
27
        $firewallMapFactory->addRequestMatcher($requestMatcherMock->reveal());
28
29
        $firewallHandlerMock = $this->prophesize(FirewallHandlerInterface::class);
30
        $firewallHandlerMock->getFirewallName()->willReturn('someFirewall');
31
        $firewallMapFactory->addFirewallHandler($firewallHandlerMock->reveal());
32
33
        return $firewallMapFactory;
34
    }
35
}
36