Skip to content

Commit 0ac99b8

Browse files
committed
add unitary tests
1 parent ca1c4d7 commit 0ac99b8

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

tests/GraphQl/ExecutorTest.php

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the API Platform project.
5+
*
6+
* (c) Kévin Dunglas <dunglas@gmail.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
declare(strict_types=1);
13+
14+
namespace ApiPlatform\Tests\GraphQl;
15+
16+
use ApiPlatform\GraphQl\Executor;
17+
use PHPUnit\Framework\TestCase;
18+
use GraphQL\Validator\DocumentValidator;
19+
use GraphQL\Validator\Rules\DisableIntrospection;
20+
21+
/**
22+
* @author Alan Poulain <contact@alanpoulain.eu>
23+
*/
24+
class ExecutorTest extends TestCase
25+
{
26+
public function testEnableIntrospectionQuery(): void
27+
{
28+
$executor = new Executor(true);
29+
30+
$expected = new DisableIntrospection(DisableIntrospection::ENABLED);
31+
32+
$this->assertIsObject($executor);
33+
$this->assertEquals($expected, DocumentValidator::getRule('DisableIntrospection'));
34+
}
35+
36+
public function testDisableIntrospectionQuery(): void
37+
{
38+
$executor = new Executor(false);
39+
40+
$expected = new DisableIntrospection(DisableIntrospection::DISABLED);
41+
42+
$this->assertIsObject($executor);
43+
$this->assertEquals($expected, DocumentValidator::getRule('DisableIntrospection'));
44+
}
45+
}

0 commit comments

Comments
 (0)