Skip to content

Commit f3700f8

Browse files
author
Pascal de Vink
authored
Merge c2ab6f5 into f29db9b
2 parents f29db9b + c2ab6f5 commit f3700f8

File tree

14 files changed

+77
-34
lines changed

14 files changed

+77
-34
lines changed

.travis.yml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
dist: trusty
2-
31
language: php
42

3+
sudo: false
4+
55
branches:
66
only:
77
- master
@@ -12,27 +12,29 @@ matrix:
1212
include:
1313
- php: 5.5
1414
env: SYMFONY_VERSION=2.8.*
15-
- php: 5.6
16-
env: SYMFONY_VERSION=3.1.*
1715
- php: 7.0
1816
env: SYMFONY_VERSION=3.2.*
1917
- php: 7.1
2018
env: SYMFONY_VERSION=3.3.* TEST_COVERAGE=true
2119
- php: 7.1
22-
env: GRAPHQLPHP_VERSION=0.10.0
20+
env: SYMFONY_VERSION=3.4.* GRAPHQLPHP_VERSION=0.10.0 DEPENDENCIES=dev
21+
- php: 7.1
22+
env: SYMFONY_VERSION=4.0.* DEPENDENCIES=dev
2323
- php: hhvm
24+
dist: trusty
25+
group: edge
2426
- php: nightly
2527
env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs
2628
allow_failures:
2729
- php: nightly
28-
env: COMPOSER_UPDATE_FLAGS=--ignore-platform-reqs
2930

3031
cache:
3132
directories:
3233
- $HOME/.composer/cache
3334
- $HOME/.php_cs.cache
3435

3536
before_install:
37+
- if [ "$DEPENDENCIES" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi;
3638
- if [ ${TEST_COVERAGE} != true ]; then phpenv config-rm xdebug.ini || true; fi
3739
- composer selfupdate
3840
- if [ $SYMFONY_VERSION ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" "symfony/framework-bundle:${SYMFONY_VERSION}" --dev --no-update; fi;
@@ -42,7 +44,7 @@ install: composer update --prefer-source --no-interaction --optimize-autoloader
4244

4345
script:
4446
- bin/phpunit --debug $( if [ $TEST_COVERAGE = true ]; then echo "-d xdebug.max_nesting_level=1000 --coverage-clover=build/logs/clover.xml"; fi; )
45-
- if [ ${TRAVIS_PHP_VERSION} == "7.0" ]; then bin/php-cs-fixer fix --diff --dry-run -v; fi;
47+
- if [ ${TRAVIS_PHP_VERSION} == "7.0" ]; then composer require --dev 'friendsofphp/php-cs-fixer:^2.0' && bin/php-cs-fixer fix --diff --dry-run -v; fi;
4648

4749
after_script:
4850
- if [ ${TEST_COVERAGE} = true ]; then wget https://scrutinizer-ci.com/ocular.phar && travis_retry php ocular.phar code-coverage:upload --format=php-clover build/logs/clover.xml; fi

CONTRIBUTING.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@ Giving some love to PHP CS
1616
---------------------------
1717

1818
```bash
19-
bin/php-cs-fixer fix ./
19+
composer require --dev 'friendsofphp/php-cs-fixer:^2.0'
20+
bin/php-cs-fixer fix
2021
```

DependencyInjection/OverblogGraphQLExtension.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,12 +119,16 @@ private function setVersions(array $config, ContainerBuilder $container)
119119

120120
private function setConfigBuilders(array $config, ContainerBuilder $container)
121121
{
122+
$useObjectToAddResource = method_exists($container, 'addObjectResource');
123+
$objectToAddResourceMethod = $useObjectToAddResource ? 'addObjectResource' : 'addClassResource';
124+
122125
foreach (['args', 'field'] as $category) {
123126
if (!empty($config['definitions']['builders'][$category])) {
124127
$method = 'add'.ucfirst($category).'BuilderClass';
125128

126129
foreach ($config['definitions']['builders'][$category] as $params) {
127-
$container->addClassResource(new \ReflectionClass($params['class']));
130+
$object = $useObjectToAddResource ? $params['class'] : new \ReflectionClass($params['class']);
131+
$container->$objectToAddResourceMethod($object);
128132
TypeWithOutputFieldsDefinition::$method($params['alias'], $params['class']);
129133
}
130134
}

Resources/config/services.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ services:
1616

1717
overblog_graphql.request_executor:
1818
class: Overblog\GraphQLBundle\Request\Executor
19+
public: true
1920
arguments:
2021
- "@overblog_graphql.executor"
2122
- "@event_dispatcher"
@@ -28,8 +29,14 @@ services:
2829
- ["setMaxQueryComplexity", ["%overblog_graphql.query_max_complexity%"]]
2930
- ["setMaxQueryDepth", ["%overblog_graphql.query_max_depth%"]]
3031

32+
Overblog\GraphQLBundle\Request\Executor:
33+
alias: overblog_graphql.request_executor
34+
3135
overblog_graphql.request_parser:
3236
class: Overblog\GraphQLBundle\Request\Parser
37+
public: true
38+
39+
3340

3441
overblog_graphql.request_batch_parser:
3542
class: Overblog\GraphQLBundle\Request\BatchParser
@@ -43,20 +50,36 @@ services:
4350

4451
overblog_graphql.type_resolver:
4552
class: Overblog\GraphQLBundle\Resolver\TypeResolver
53+
public: true
4654
arguments:
4755
-
4856

57+
Overblog\GraphQLBundle\Resolver\TypeResolver:
58+
alias: overblog_graphql.type_resolver
59+
4960
overblog_graphql.resolver_resolver:
5061
class: Overblog\GraphQLBundle\Resolver\ResolverResolver
62+
public: true
63+
64+
Overblog\GraphQLBundle\Resolver\ResolverResolver:
65+
alias: overblog_graphql.resolver_resolver
5166

5267
overblog_graphql.mutation_resolver:
5368
class: Overblog\GraphQLBundle\Resolver\MutationResolver
69+
public: true
70+
71+
Overblog\GraphQLBundle\Resolver\MutationResolver:
72+
alias: overblog_graphql.mutation_resolver
5473

5574
overblog_graphql.access_resolver:
5675
class: Overblog\GraphQLBundle\Resolver\AccessResolver
76+
public: true
5777
arguments:
5878
- "@overblog_graphql.promise_adapter"
5979

80+
Overblog\GraphQLBundle\Resolver\AccessResolver:
81+
alias: overblog_graphql.access_resolver
82+
6083
overblog_graphql.expression_language.default:
6184
class: Overblog\GraphQLBundle\ExpressionLanguage\ExpressionLanguage
6285
public: false
@@ -68,6 +91,7 @@ services:
6891

6992
overblog_graphql.cache_compiler:
7093
class: Overblog\GraphQLBundle\Generator\TypeGenerator
94+
public: true
7195
arguments:
7296
- "%overblog_graphql.class_namespace%"
7397
- ["%overblog_graphql.resources_dir%/skeleton"]
@@ -81,6 +105,7 @@ services:
81105

82106
overblog_graphql.event_listener.request_file_listener:
83107
class: Overblog\GraphQLBundle\EventListener\RequestFilesListener
108+
public: true
84109
arguments:
85110
- "@request_stack"
86111
tags:
@@ -106,6 +131,7 @@ services:
106131

107132
overblog_graphql.command.dump_schema:
108133
class: Overblog\GraphQLBundle\Command\GraphQLDumpSchemaCommand
134+
public: true
109135
arguments:
110136
# "overblog_graphql.request_executor" service must be load lazy since that command service
111137
# is instanced before ClassLoaderEvent. This issues is fix in Symfony 3.4 introducing lazy commands
@@ -118,6 +144,7 @@ services:
118144

119145
overblog_graphql.command.debug:
120146
class: Overblog\GraphQLBundle\Command\DebugCommand
147+
public: true
121148
arguments:
122149
- "@overblog_graphql.type_resolver"
123150
- "@overblog_graphql.mutation_resolver"

Tests/Functional/App/TestKernel.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ public function __construct($environment, $debug, $testCase = null)
3434

3535
public function getCacheDir()
3636
{
37-
return sys_get_temp_dir().'/OverblogGraphQLBundle/'.Kernel::VERSION.'/'.$this->testCase.'/cache/'.$this->environment;
37+
return $this->basePath().'cache/'.$this->environment;
3838
}
3939

4040
public function getLogDir()
4141
{
42-
return sys_get_temp_dir().'/OverblogGraphQLBundle/'.Kernel::VERSION.'/'.$this->testCase.'/logs';
42+
return $this->basePath().'logs';
4343
}
4444

4545
public function getRootDir()
@@ -63,4 +63,9 @@ public function registerContainerConfiguration(LoaderInterface $loader)
6363
$loader->load(__DIR__.'/config/config.yml');
6464
}
6565
}
66+
67+
private function basePath()
68+
{
69+
return sys_get_temp_dir().'/OverblogGraphQLBundle/'.Kernel::VERSION.'/'.($this->testCase ? $this->testCase.'/' : '');
70+
}
6671
}

Tests/Functional/App/config/global/config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ imports:
44
services:
55
overblog_graphql.test.resolver.global:
66
class: Overblog\GraphQLBundle\Tests\Functional\App\Resolver\GlobalResolver
7+
public: true
78
arguments:
89
- "@overblog_graphql.type_resolver"
910

Tests/Functional/Controller/GraphControllerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
66
use Symfony\Component\HttpKernel\Client;
77

8+
/**
9+
* @runTestsInSeparateProcesses
10+
*/
811
class GraphControllerTest extends TestCase
912
{
1013
private $friendsQuery = <<<'EOF'

Tests/Functional/Controller/GraphiQLControllerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
66

7+
/**
8+
* @runTestsInSeparateProcesses
9+
*/
710
class GraphiQLControllerTest extends TestCase
811
{
912
/**

Tests/Functional/Exception/ExceptionTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44

55
use Overblog\GraphQLBundle\Tests\Functional\TestCase;
66

7-
/**
8-
* Class ConnectionTest.
9-
*
10-
* @see https://github.com/graphql/graphql-relay-js/blob/master/src/connection/__tests__/connection.js
11-
*/
127
class ExceptionTest extends TestCase
138
{
149
protected function setUp()

Tests/Functional/Relay/Connection/ConnectionTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* Class ConnectionTest.
99
*
1010
* @see https://github.com/graphql/graphql-relay-js/blob/master/src/connection/__tests__/connection.js
11+
* @runTestsInSeparateProcesses
1112
*/
1213
class ConnectionTest extends TestCase
1314
{

0 commit comments

Comments
 (0)