Completed
Pull Request — master (#80)
by John
07:39 queued 04:25
created

canReverseLookupPreviouslyResolvedType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
c 1
b 1
f 0
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php declare(strict_types = 1);
2
/*
3
 * This file is part of the KleijnWeb\SwaggerBundle package.
4
 *
5
 * For the full copyright and license information, please view the LICENSE
6
 * file that was distributed with this source code.
7
 */
8
9
namespace KleijnWeb\SwaggerBundle\Tests\Serialize;
10
11
use KleijnWeb\SwaggerBundle\Serialize\SerializationTypeResolver;
12
13
/**
14
 * @author John Kleijn <[email protected]>
15
 */
16
class SerializationTypeResolverTest extends \PHPUnit_Framework_TestCase
17
{
18
    /**
19
     * @var SerializationTypeResolver
20
     */
21
    private $resolver;
22
23
    protected function setUp()
24
    {
25
        $this->resolver = new SerializationTypeResolver([
26
            'KleijnWeb\SwaggerBundle\Tests\Serialize\Stubs\Namespace2',
27
            'KleijnWeb\SwaggerBundle\Tests\Serialize\Stubs\Namespace1'
28
        ]);
29
    }
30
31
    /**
32
     * @test
33
     */
34
    public function canResolveTypesInOrderUsingMultipleNamespaces()
35
    {
36
        $this->assertSame(Stubs\Namespace2\Foo::class, $this->resolver->resolveUsingTypeName('Foo'));
37
    }
38
39
    /**
40
     * @test
41
     */
42
    public function canReverseLookupPreviouslyResolvedType()
43
    {
44
        $this->resolver->resolveUsingTypeName('Foo');
45
        $this->assertSame('Foo', $this->resolver->reverseLookup(Stubs\Namespace2\Foo::class));
46
    }
47
}
48