NameResolverSpec   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 23
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A let() 0 4 1
A it_is_initializable() 0 5 1
A it_resolves() 0 4 1
A it_does_not_resolves_when_class_name_does_not_exist() 0 4 1
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Spec\Kreta\SharedKernel\Serialization;
16
17
use Kreta\SharedKernel\Serialization\ClassNameDoesNotExistException;
18
use Kreta\SharedKernel\Serialization\NameResolver;
19
use Kreta\SharedKernel\Serialization\Resolver;
20
use Kreta\SharedKernel\Tests\Double\Serialization\NameResolverStub;
21
use PhpSpec\ObjectBehavior;
22
23
class NameResolverSpec extends ObjectBehavior
24
{
25
    function let()
26
    {
27
        $this->beAnInstanceOf(NameResolverStub::class);
28
    }
29
30
    function it_is_initializable()
31
    {
32
        $this->shouldHaveType(NameResolver::class);
33
        $this->shouldImplement(Resolver::class);
34
    }
35
36
    function it_resolves()
37
    {
38
        $this->resolve('Fully\Qualified\Class\Name')->shouldReturn('dummy_name');
39
    }
40
41
    function it_does_not_resolves_when_class_name_does_not_exist()
42
    {
43
        $this->shouldThrow(ClassNameDoesNotExistException::class)->duringResolve('Other\Fully\Qualified\Class\Name');
44
    }
45
}
46