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

Issue109Test   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 3
dl 0
loc 28
rs 10
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
namespace Youshido\Tests\Issues\Issue109;
15
16
use Youshido\GraphQL\Execution\Processor;
17
18
class Issue109Test extends \PHPUnit_Framework_TestCase
19
{
20
    public function testInternalVariableArgument(): void
21
    {
22
        $schema    = new Issue109Schema();
23
        $processor = new Processor($schema);
24
        $response  = $processor->processPayload(
25
            '
26
query ($postId: Int, $commentId: Int) { 
27
    latestPost(id: $postId) { 
28
        id(comment_id: $commentId),
29
        comments(comment_id: $commentId) {
30
            comment_id
31
        } 
32
    } 
33
}',
34
            [
35
                'postId'    => 1,
36
                'commentId' => 100,
37
            ]
38
        )->getResponseData();
39
        $this->assertEquals(['data' => ['latestPost' => [
40
            'id'       => 1,
41
            'comments' => [
42
                ['comment_id' => 100],
43
            ],
44
        ]]], $response);
45
    }
46
}
47