Completed
Pull Request — master (#204)
by Ryan
11:34
created

ResolveInfoTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 8

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 8
dl 0
loc 16
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Copyright (c) 2015–2018 Alexandr Viniychuk <http://youshido.com>.
4
 * Copyright (c) 2015–2018 Portey Vasil <https://github.com/portey>.
5
 * Copyright (c) 2018 Ryan Parman <https://github.com/skyzyx>.
6
 * Copyright (c) 2018 Ashley Hutson <https://github.com/asheliahut>.
7
 * Copyright (c) 2015–2018 Contributors.
8
 *
9
 * http://opensource.org/licenses/MIT
10
 */
11
12
declare(strict_types=1);
13
/*
14
 * This file is a part of GraphQL project.
15
 *
16
 * @author Alexandr Viniychuk <[email protected]>
17
 * created: 5/19/16 1:28 PM
18
 */
19
20
namespace Youshido\Tests\Schema;
21
22
use Youshido\GraphQL\Execution\Context\ExecutionContext;
23
use Youshido\GraphQL\Execution\ResolveInfo;
24
use Youshido\GraphQL\Field\Field;
25
use Youshido\GraphQL\Parser\Ast\Field as FieldAST;
26
use Youshido\GraphQL\Parser\Location;
27
use Youshido\GraphQL\Type\Scalar\IntType;
28
use Youshido\Tests\DataProvider\TestSchema;
29
30
class ResolveInfoTest extends \PHPUnit_Framework_TestCase
31
{
32
    public function testMethods(): void
33
    {
34
        $fieldAst         = new FieldAST('name', null, [], [], new Location(1, 1));
35
        $field            = new Field(['name' => 'id', 'type' => new IntType()]);
36
        $returnType       = new IntType();
37
        $executionContext = new ExecutionContext(new TestSchema());
38
        $info             = new ResolveInfo($field, [$fieldAst], $executionContext);
39
40
        $this->assertEquals($field, $info->getField());
41
        $this->assertEquals([$fieldAst], $info->getFieldASTList());
42
        $this->assertEquals($returnType, $info->getReturnType());
43
        $this->assertEquals($executionContext, $info->getExecutionContext());
44
    }
45
}
46