Completed
Branch master (c0d8ef)
by Yaroslav
06:36
created

ClassMapTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 9
dl 0
loc 24
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testGet() 0 5 1
A testHas() 0 6 1
A testGetException() 0 7 1
1
<?php
2
3
/*
4
 *
5
 * (c) Yaroslav Honcharuk <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
11
namespace Yarhon\RouteGuardBundle\Tests\DependencyInjection\Container;
12
13
use PHPUnit\Framework\TestCase;
14
use Yarhon\RouteGuardBundle\DependencyInjection\Container\ClassMap;
15
use Yarhon\RouteGuardBundle\Exception\InvalidArgumentException;
16
17
/**
18
 * @author Yaroslav Honcharuk <[email protected]>
19
 */
20
class ClassMapTest extends TestCase
21
{
22
    public function testHas()
23
    {
24
        $map = new ClassMap(['test1' => 'class_name']);
25
26
        $this->assertTrue($map->has('test1'));
27
        $this->assertFalse($map->has('test2'));
28
    }
29
30
    public function testGet()
31
    {
32
        $map = new ClassMap(['test1' => 'class_name']);
33
34
        $this->assertEquals('class_name', $map->get('test1'));
35
    }
36
37
    public function testGetException()
38
    {
39
        $map = new ClassMap(['test1' => 'class_name']);
40
41
        $this->expectException(InvalidArgumentException::class);
42
43
        $map->get('test2');
44
    }
45
}
46