Passed
Push — master ( c48cdc...faf2fe )
by Adrien
06:19
created

SchemaTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
eloc 10
c 1
b 0
f 0
dl 0
loc 25
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSchemaCanBeIntrospected() 0 8 1
A testSchemaIsValid() 0 5 1
A setUp() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Api;
6
7
use Application\Api\Schema;
8
use GraphQL\GraphQL;
9
use GraphQL\Type\Introspection;
10
use PHPUnit\Framework\TestCase;
11
12
class SchemaTest extends TestCase
13
{
14
    private Schema $schema;
15
16
    protected function setUp(): void
17
    {
18
        parent::setUp();
19
        $this->schema = new Schema();
20
    }
21
22
    public function testSchemaIsValid(): void
23
    {
24
        $this->schema->assertValid();
25
26
        self::assertTrue(true, 'schema passes validation');
27
    }
28
29
    public function testSchemaCanBeIntrospected(): void
30
    {
31
        $result = GraphQL::executeQuery(
32
            $this->schema,
33
            Introspection::getIntrospectionQuery()
34
        );
35
36
        self::assertSame([], $result->errors, 'should not have any errors during introspection');
37
    }
38
}
39