Completed
Push — master ( ce0ced...50615c )
by Alexandr
02:46
created

TypeMapTest::testScalarTypeObjectCreation()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 8
rs 9.4286
cc 2
eloc 5
nc 2
nop 0
1
<?php
2
/*
3
* This file is a part of GraphQL project.
4
*
5
* @author Alexandr Viniychuk <[email protected]>
6
* created: 12/4/15 12:34 AM
7
*/
8
9
namespace Youshido\Tests\Type;
10
11
12
use Youshido\GraphQL\Type\TypeMap;
13
14
class TypeMapTest extends \PHPUnit_Framework_TestCase
15
{
16
17
    public function testScalarTypesSet()
18
    {
19
        $this->assertEquals($this->getScalarTypes(), TypeMap::getScalarTypes());
20
    }
21
22
    public function testScalarTypeCheck()
23
    {
24
        foreach($this->getScalarTypes() as $type) {
25
            $this->assertTrue(TypeMap::isInputType($type));
26
        }
27
    }
28
29
    public function testScalarTypeObjectCreation()
30
    {
31
        foreach($this->getScalarTypes() as $type) {
32
            $object = TypeMap::getScalarTypeObject($type);
33
            $this->assertEquals($object->getKind(), TypeMap::KIND_SCALAR);
34
            $this->assertEquals($object->getName(), $type);
35
        }
36
    }
37
38
39
    private function getScalarTypes()
40
    {
41
        return [
42
            TypeMap::TYPE_INT, TypeMap::TYPE_FLOAT, TypeMap::TYPE_STRING, TypeMap::TYPE_BOOLEAN, TypeMap::TYPE_ID
43
        ];
44
    }
45
}
46