Passed
Pull Request — master (#40)
by David
01:43
created

GlobControllerQueryProviderTest.php$0 ➔ get()   A

Complexity

Conditions 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
1
<?php
2
3
namespace TheCodingMachine\GraphQL\Controllers;
4
5
use Psr\Container\ContainerInterface;
6
use Symfony\Component\Cache\Simple\NullCache;
7
use TheCodingMachine\GraphQL\Controllers\Fixtures\TestController;
8
9
class GlobControllerQueryProviderTest extends AbstractQueryProviderTest
10
{
11
    public function testGlob()
12
    {
13
        $controller = new TestController();
14
15
        $container = new class([ TestController::class => $controller ]) implements ContainerInterface {
16
            /**
17
             * @var array
18
             */
19
            private $controllers;
20
21
            public function __construct(array $controllers)
22
            {
23
                $this->controllers = $controllers;
24
            }
25
26
            public function get($id)
27
            {
28
                return $this->controllers[$id];
29
            }
30
31
            public function has($id)
32
            {
33
                return isset($this->controllers[$id]);
34
            }
35
        };
36
37
        $globControllerQueryProvider = new GlobControllerQueryProvider('TheCodingMachine\\GraphQL\\Controllers', $this->getRegistry(), $container, new NullCache());
38
39
        $queries = $globControllerQueryProvider->getQueries();
40
        $this->assertCount(5, $queries);
41
42
        $mutations = $globControllerQueryProvider->getMutations();
43
        $this->assertCount(1, $mutations);
44
45
    }
46
}
47