Passed
Pull Request — master (#3)
by
unknown
05:56 queued 02:23
created

MutationTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 22
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A testMutation() 0 27 1
1
<?php
2
3
namespace Tests\Commadore\GraphQL;
4
5
use Commadore\GraphQL\Mutation;
6
use PHPUnit\Framework\TestCase;
7
8
class MutationTest extends TestCase
9
{
10
    public function testMutation()
11
    {
12
        $mutation = new Mutation('createReview');
13
        $mutation
14
            ->operationName('CreateReviewForEpisode')
15
            ->variables([
16
                '$ep' => 'Episode!',
17
                '$review' => 'ReviewInput!',
18
            ])
19
            ->arguments([
20
                'episode' => '$ep',
21
                'review' => '$review',
22
            ])
23
            ->fields([
24
                'stars',
25
                'commentary',
26
            ]);
27
28
        $expected =
29
'mutation CreateReviewForEpisode($ep: Episode!, $review: ReviewInput!) {
30
  createReview(episode: $ep, review: $review) {
31
    commentary
32
    stars
33
  }
34
}
35
';
36
        $this->assertEquals($expected, (string) $mutation);
37
    }
38
}
39