1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of the OverblogGraphQLBundle package. |
5
|
|
|
* |
6
|
|
|
* (c) Overblog <http://github.com/overblog/> |
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
|
|
|
namespace Overblog\GraphQLBundle\Tests\Resolver\Config; |
13
|
|
|
|
14
|
|
|
use Overblog\GraphQLBundle\ExpressionLanguage\ExpressionLanguage; |
15
|
|
|
use Overblog\GraphQLBundle\Resolver\Config\AbstractConfigSolution; |
16
|
|
|
use Overblog\GraphQLBundle\Resolver\ConfigResolver; |
17
|
|
|
use Overblog\GraphQLBundle\Tests\DIContainerMockTrait; |
18
|
|
|
|
19
|
|
|
abstract class AbstractConfigSolutionTest extends \PHPUnit_Framework_TestCase |
20
|
|
|
{ |
21
|
|
|
use DIContainerMockTrait; |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @var AbstractConfigSolution |
25
|
|
|
*/ |
26
|
|
|
protected $configSolution; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* @return AbstractConfigSolution |
30
|
|
|
*/ |
31
|
|
|
abstract protected function createConfigSolution(); |
32
|
|
|
|
33
|
|
|
public function setUp() |
34
|
|
|
{ |
35
|
|
|
$container = $this->getDIContainerMock(); |
36
|
|
|
$container |
37
|
|
|
->method('get') |
38
|
|
|
->will($this->returnValue(new \stdClass())); |
39
|
|
|
|
40
|
|
|
$expressionLanguage = new ExpressionLanguage(); |
41
|
|
|
$expressionLanguage->setContainer($container); |
42
|
|
|
|
43
|
|
|
$typeResolver = $this->getMockBuilder('Overblog\GraphQLBundle\Resolver\TypeResolver') |
44
|
|
|
->disableOriginalConstructor() |
45
|
|
|
->getMock(); |
46
|
|
|
$typeResolver |
47
|
|
|
->method('resolve') |
48
|
|
|
->will($this->returnValue(new \stdClass())); |
49
|
|
|
|
50
|
|
|
$fieldResolver = $this->getMockBuilder('Overblog\GraphQLBundle\Resolver\FieldResolver') |
51
|
|
|
->disableOriginalConstructor() |
52
|
|
|
->getMock(); |
53
|
|
|
$fieldResolver |
54
|
|
|
->method('resolve') |
55
|
|
|
->will($this->returnValue(new \stdClass())); |
56
|
|
|
|
57
|
|
|
$argResolver = $this->getMockBuilder('Overblog\GraphQLBundle\Resolver\ArgResolver') |
58
|
|
|
->disableOriginalConstructor() |
59
|
|
|
->getMock(); |
60
|
|
|
$argResolver |
61
|
|
|
->method('resolve') |
62
|
|
|
->will($this->returnValue(new \stdClass())); |
63
|
|
|
|
64
|
|
|
$this->configSolution = $this->createConfigSolution(); |
65
|
|
|
|
66
|
|
|
$this->configSolution->setConfigResolver(new ConfigResolver()) |
67
|
|
|
->setArgResolver($argResolver) |
68
|
|
|
->setFieldResolver($fieldResolver) |
69
|
|
|
->setTypeResolver($typeResolver) |
70
|
|
|
->setExpressionLanguage($expressionLanguage); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|