Completed
Push — master ( 8085b1...79cabf )
by David
17s
created

TypeResolverTest::testMapNameToType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace TheCodingMachine\GraphQL\Controllers\Types;
4
5
use GraphQL\Type\Definition\IDType;
6
use GraphQL\Type\Schema;
7
use PHPUnit\Framework\TestCase;
8
use RuntimeException;
9
use TheCodingMachine\GraphQL\Controllers\Mappers\CannotMapTypeException;
10
11
class TypeResolverTest extends TestCase
12
{
13
    public function testException()
14
    {
15
        $typeResolver = new TypeResolver();
16
        $this->expectException(RuntimeException::class);
17
        $typeResolver->mapNameToType('ID');
18
    }
19
20
    public function testMapNameToType()
21
    {
22
        $typeResolver = new TypeResolver();
23
        $schema = new Schema([]);
24
        $typeResolver->registerSchema($schema);
25
        $this->assertInstanceOf(IDType::class, $typeResolver->mapNameToType('ID'));
26
27
        $this->expectException(CannotMapTypeException::class);
28
        $typeResolver->mapNameToType('NotExists');
29
    }
30
}
31