From 16648c5051f9246a3a0eb6d8a8008c1a11abe81b Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Tue, 4 Oct 2016 16:04:08 +0200 Subject: [PATCH 1/3] Add debug information --- DependencyInjection/Configuration.php | 1 + .../OverblogGraphQLExtension.php | 1 + README.md | 26 ++++++++++ Request/Executor.php | 33 ++++++++++++- Resources/config/services.yml | 1 + Tests/Request/ExecutorTest.php | 48 ++++++++++++++++++- 6 files changed, 108 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index e61942751..00ee66404 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -44,6 +44,7 @@ public function getConfigTreeBuilder() ->addDefaultsIfNotSet() ->children() ->scalarNode('internal_error_message')->defaultNull()->end() + ->booleanNode('show_debug_info')->defaultValue(false)->end() ->booleanNode('config_validation')->defaultValue($this->debug)->end() ->arrayNode('schema') ->beforeNormalization() diff --git a/DependencyInjection/OverblogGraphQLExtension.php b/DependencyInjection/OverblogGraphQLExtension.php index 5eb774e44..493d4e2e4 100644 --- a/DependencyInjection/OverblogGraphQLExtension.php +++ b/DependencyInjection/OverblogGraphQLExtension.php @@ -40,6 +40,7 @@ public function load(array $configs, ContainerBuilder $container) $this->setConfigBuilders($config); $this->setVersions($config, $container); + $container->getDefinition('overblog_graphql.request_executor')->replaceArgument(3, $config['definitions']['show_debug_info']); $container->setParameter($this->getAlias().'.resources_dir', realpath(__DIR__.'/../Resources')); } diff --git a/README.md b/README.md index 7ce39dbb8..1a00d54ea 100644 --- a/README.md +++ b/README.md @@ -935,6 +935,32 @@ simple request | `/graphql/bar` batch request | `/graphql/bar/batch` graphiQL | `/graphiql/bar` +Debug information +----------------- + +To enabled or disabled debug information: + +```yaml +# app/config/config.yml + +overblog_graphql: + definitions: + show_debug_info: true # Debug info is disabled by default +``` + +here an example of an answer when debug information is enabled +```json +{ + "data": [{"isEnabled": true}], + "extensions": { + "debug": { + "executionTime": "400 ms", + "memoryUsage": "1.00 MiB" + } + } +} +``` + Contribute ---------- diff --git a/Request/Executor.php b/Request/Executor.php index 559737cc2..68533e6ce 100644 --- a/Request/Executor.php +++ b/Request/Executor.php @@ -40,11 +40,15 @@ class Executor /** @var ErrorHandler|null */ private $errorHandler; - public function __construct(EventDispatcherInterface $dispatcher = null, $throwException = false, ErrorHandler $errorHandler = null) + /** @var bool */ + private $hasDebugInfo; + + public function __construct(EventDispatcherInterface $dispatcher = null, $throwException = false, ErrorHandler $errorHandler = null, $hasDebugInfo = false) { $this->dispatcher = $dispatcher; $this->throwException = (bool) $throwException; $this->errorHandler = $errorHandler; + $hasDebugInfo ? $this->enabledDebugInfo() : $this->disabledDebugInfo(); } public function addSchema($name, Schema $schema) @@ -54,6 +58,23 @@ public function addSchema($name, Schema $schema) return $this; } + public function enabledDebugInfo() + { + $this->hasDebugInfo = true; + return $this; + } + + public function disabledDebugInfo() + { + $this->hasDebugInfo = false; + return $this; + } + + public function hasDebugInfo() + { + return $this->hasDebugInfo; + } + public function setMaxQueryDepth($maxQueryDepth) { /** @var QueryDepth $queryDepth */ @@ -90,6 +111,9 @@ public function execute(array $data, array $context = [], $schemaName = null) $schema = $this->getSchema($schemaName); + $startTime = microtime(true); + $startMemoryUsage = memory_get_usage(true); + $executionResult = GraphQL::executeAndReturnResult( $schema, isset($data[ParserInterface::PARAM_QUERY]) ? $data[ParserInterface::PARAM_QUERY] : null, @@ -99,6 +123,13 @@ public function execute(array $data, array $context = [], $schemaName = null) isset($data[ParserInterface::PARAM_OPERATION_NAME]) ? $data[ParserInterface::PARAM_OPERATION_NAME] : null ); + if ($this->hasDebugInfo()) { + $executionResult->extensions['debug'] = [ + 'executionTime' => sprintf('%d ms', round(microtime(true) - $startTime, 1) * 1000), + 'memoryUsage' => sprintf('%.2F MiB', (memory_get_usage(true) - $startMemoryUsage) / 1024 / 1024), + ]; + } + if (null !== $this->errorHandler) { $this->errorHandler->handleErrors($executionResult, $this->throwException); } diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 34d766bdd..75732d3c0 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -17,6 +17,7 @@ services: - "@event_dispatcher" - "%kernel.debug%" - "@overblog_graphql.error_handler" + - false calls: - ["setMaxQueryComplexity", ["%overblog_graphql.query_max_complexity%"]] - ["setMaxQueryDepth", ["%overblog_graphql.query_max_depth%"]] diff --git a/Tests/Request/ExecutorTest.php b/Tests/Request/ExecutorTest.php index 6797d6b55..e7befcd5e 100644 --- a/Tests/Request/ExecutorTest.php +++ b/Tests/Request/ExecutorTest.php @@ -11,16 +11,62 @@ namespace Overblog\GraphQLBundle\Tests\Resolver; +use GraphQL\Schema; +use GraphQL\Type\Definition\ObjectType; +use GraphQL\Type\Definition\Type; use Overblog\GraphQLBundle\Request\Executor; class ExecutorTest extends \PHPUnit_Framework_TestCase { + /** @var Executor */ + private $executor; + + private $request = ['query' => 'query debug{ myField }', 'variables' => [], 'operationName' => null]; + + public function setUp() + { + $this->executor = new Executor(); + } + + public function testDisabledDebugInfo() + { + $this->addSchema(); + $this->assertArrayNotHasKey('debug', $this->executor->disabledDebugInfo()->execute($this->request)->extensions); + } + + public function testEnabledDebugInfo() + { + $this->addSchema(); + $result = $this->executor->enabledDebugInfo()->execute($this->request); + + $this->assertArrayHasKey('debug', $result->extensions); + $this->assertArrayHasKey('executionTime', $result->extensions['debug']); + $this->assertArrayHasKey('memoryUsage', $result->extensions['debug']); + } + /** * @expectedException \RuntimeException * @expectedExceptionMessage At least one schema should be declare. */ public function testGetSchemaNoSchemaFound() { - (new Executor())->getSchema('default'); + $this->executor->getSchema('fake'); + } + + private function addSchema() + { + $queryType = new ObjectType([ + 'name' => 'Query', + 'fields' => [ + 'myField' => [ + 'type' => Type::boolean(), + 'resolve' => function () { + return false; + }, + ] + ] + ]); + + $this->executor->addSchema('global', new Schema(['query' => $queryType])); } } From cb68d15cdf8f535ac0133c1b160c824e3bb9938f Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Tue, 4 Oct 2016 16:06:27 +0200 Subject: [PATCH 2/3] Fix code style --- Config/EnumTypeDefinition.php | 8 +++-- Config/ObjectTypeDefinition.php | 1 - DependencyInjection/Configuration.php | 18 ++++++---- .../OverblogGraphQLExtension.php | 3 +- .../OverblogGraphQLTypesExtension.php | 1 - DependencyInjection/TypesConfiguration.php | 8 +++-- Error/ErrorHandler.php | 3 +- .../AuthorizationExpressionProvider.php | 24 ++++++++----- .../ConfigExpressionProvider.php | 36 ++++++++++++------- Generator/TypeGenerator.php | 5 +-- Relay/Connection/Output/Connection.php | 4 +-- Relay/Connection/Output/ConnectionBuilder.php | 2 +- Relay/Connection/Output/Edge.php | 4 +-- Relay/Connection/Output/PageInfo.php | 8 ++--- Relay/Mutation/MutationFieldDefinition.php | 2 +- .../PluralIdentifyingRootFieldDefinition.php | 2 +- Request/Executor.php | 2 ++ Tests/DIContainerMockTrait.php | 2 +- .../OverblogGraphQLTypesExtensionTest.php | 6 ++-- Tests/Error/ErrorHandlerTest.php | 2 +- .../Controller/GraphControllerTest.php | 15 ++++---- .../Controller/GraphiQLControllerTest.php | 2 +- Tests/Functional/Exception/ExceptionTest.php | 4 +-- .../Relay/Connection/ConnectionTest.php | 6 ++-- .../Relay/Mutation/MutationTest.php | 12 +++---- Tests/Functional/Relay/Node/GlobalTest.php | 4 +-- Tests/Functional/Relay/Node/NodeTest.php | 18 +++++----- Tests/Functional/Relay/Node/PluralTest.php | 4 +-- Tests/Functional/Security/AccessTest.php | 6 ++-- .../Security/QueryComplexityTest.php | 4 +-- .../app/Resolver/GlobalResolver.php | 2 +- .../Functional/app/Resolver/NodeResolver.php | 2 +- Tests/Request/ExecutorTest.php | 4 +-- 33 files changed, 130 insertions(+), 94 deletions(-) diff --git a/Config/EnumTypeDefinition.php b/Config/EnumTypeDefinition.php index 763d9e5f5..21b8ee49b 100644 --- a/Config/EnumTypeDefinition.php +++ b/Config/EnumTypeDefinition.php @@ -27,8 +27,12 @@ public function getDefinition() ->useAttributeAsKey('name') ->prototype('array') ->beforeNormalization() - ->ifTrue(function ($v) { return !is_null($v) && !is_array($v); }) - ->then(function ($v) { return ['value' => $v]; }) + ->ifTrue(function ($v) { + return !is_null($v) && !is_array($v); + }) + ->then(function ($v) { + return ['value' => $v]; + }) ->end() ->isRequired() ->children() diff --git a/Config/ObjectTypeDefinition.php b/Config/ObjectTypeDefinition.php index c8f76c6c7..9c638a539 100644 --- a/Config/ObjectTypeDefinition.php +++ b/Config/ObjectTypeDefinition.php @@ -37,7 +37,6 @@ public function getDefinition() $node->validate() ->ifTrue(function ($v) { - return array_key_exists('fieldsDefaultAccess', $v) && null !== $v['fieldsDefaultAccess']; }) ->then(function ($v) { diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 00ee66404..ac675ef3c 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -30,7 +30,7 @@ class Configuration implements ConfigurationInterface */ public function __construct($debug) { - $this->debug = (Boolean) $debug; + $this->debug = (bool) $debug; } public function getConfigTreeBuilder() @@ -85,11 +85,11 @@ public function getConfigTreeBuilder() ->arrayNode('exceptions') ->children() ->arrayNode('warnings') - ->treatNullLike(array()) + ->treatNullLike([]) ->prototype('scalar')->end() ->end() ->arrayNode('errors') - ->treatNullLike(array()) + ->treatNullLike([]) ->prototype('scalar')->end() ->end() ->arrayNode('types') @@ -175,12 +175,18 @@ private function addSecurityQuerySection($name, $disabledValue) $node ->info('Disabled if equal to false.') ->beforeNormalization() - ->ifTrue(function ($v) { return false === $v; }) - ->then(function () use ($disabledValue) { return $disabledValue; }) + ->ifTrue(function ($v) { + return false === $v; + }) + ->then(function () use ($disabledValue) { + return $disabledValue; + }) ->end() ->defaultFalse() ->validate() - ->ifTrue(function ($v) { return $v < 0; }) + ->ifTrue(function ($v) { + return $v < 0; + }) ->thenInvalid('"overblog_graphql.security.'.$name.'" must be greater or equal to 0.') ->end() ; diff --git a/DependencyInjection/OverblogGraphQLExtension.php b/DependencyInjection/OverblogGraphQLExtension.php index 493d4e2e4..5644c2928 100644 --- a/DependencyInjection/OverblogGraphQLExtension.php +++ b/DependencyInjection/OverblogGraphQLExtension.php @@ -162,7 +162,8 @@ public function getConfiguration(array $config, ContainerBuilder $container) * Returns a list of custom exceptions mapped to error/warning classes. * * @param array $exceptionConfig - * @return array Custom exception map, [exception => UserError/UserWarning]. + * + * @return array Custom exception map, [exception => UserError/UserWarning] */ private function buildExceptionMap(array $exceptionConfig) { diff --git a/DependencyInjection/OverblogGraphQLTypesExtension.php b/DependencyInjection/OverblogGraphQLTypesExtension.php index c433d1b1e..25465aeae 100644 --- a/DependencyInjection/OverblogGraphQLTypesExtension.php +++ b/DependencyInjection/OverblogGraphQLTypesExtension.php @@ -105,7 +105,6 @@ private function typesConfigsMappingFromConfig(array $config, ContainerBuilder $ if (!empty($config['definitions']['mappings']['types'])) { $typesMappings = array_filter(array_map( function (array $typeMapping) use ($container) { - $params = $this->detectConfigFiles($container, $typeMapping['dir'], $typeMapping['type']); return $params; diff --git a/DependencyInjection/TypesConfiguration.php b/DependencyInjection/TypesConfiguration.php index 7a29ef3e0..13f649ebe 100644 --- a/DependencyInjection/TypesConfiguration.php +++ b/DependencyInjection/TypesConfiguration.php @@ -115,7 +115,9 @@ function ($type) { private function addBeforeNormalization(ArrayNodeDefinition $node) { - $typeKeyExists = function ($types) { return !empty($types) && is_array($types); }; + $typeKeyExists = function ($types) { + return !empty($types) && is_array($types); + }; $node // set type config.name @@ -147,7 +149,9 @@ private function addBeforeNormalization(ArrayNodeDefinition $node) ->end() // normalized relay-mutation-payload ->beforeNormalization() - ->ifTrue(function ($types) { return !empty($types) && is_array($types); }) + ->ifTrue(function ($types) { + return !empty($types) && is_array($types); + }) ->then($this->relayNormalizer('relay-mutation-payload', 'Overblog\GraphQLBundle\Relay\Mutation\PayloadDefinition')) ->end(); } diff --git a/Error/ErrorHandler.php b/Error/ErrorHandler.php index a14e0076b..fb610da23 100644 --- a/Error/ErrorHandler.php +++ b/Error/ErrorHandler.php @@ -139,12 +139,13 @@ public function handleErrors(ExecutionResult $executionResult, $throwRawExceptio * that is displayed to the user. * * @param \Exception $rawException + * * @return \Exception */ protected function convertException(\Exception $rawException = null) { if (null === $rawException) { - return null; + return; } if (!empty($this->exceptionMap[get_class($rawException)])) { diff --git a/ExpressionLanguage/AuthorizationExpressionProvider.php b/ExpressionLanguage/AuthorizationExpressionProvider.php index 5cd9c6526..a7f59fc7c 100644 --- a/ExpressionLanguage/AuthorizationExpressionProvider.php +++ b/ExpressionLanguage/AuthorizationExpressionProvider.php @@ -24,7 +24,8 @@ public function getFunctions() function ($role) { return sprintf('$container->get(\'security.authorization_checker\')->isGranted(%s)', $role); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -34,7 +35,8 @@ function ($roles) { return $code; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -42,7 +44,8 @@ function () {} function () { return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -50,7 +53,8 @@ function () {} function () { return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\')'; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -58,7 +62,8 @@ function () {} function () { return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')'; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -66,7 +71,8 @@ function () {} function () { return '$container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_REMEMBERED\') || $container->get(\'security.authorization_checker\')->isGranted(\'IS_AUTHENTICATED_FULLY\')'; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -76,7 +82,8 @@ function ($object, $permission) { return $code; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -86,7 +93,8 @@ function ($object, $permissions) { return $code; }, - function () {} + function () { + } ), ]; } diff --git a/ExpressionLanguage/ConfigExpressionProvider.php b/ExpressionLanguage/ConfigExpressionProvider.php index 90cdc3310..f885fd61c 100644 --- a/ExpressionLanguage/ConfigExpressionProvider.php +++ b/ExpressionLanguage/ConfigExpressionProvider.php @@ -25,7 +25,8 @@ public function getFunctions() function ($value) { return sprintf('$container->get(%s)', $value); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -33,7 +34,8 @@ function () {} function ($value) { return sprintf('$container->getParameter(%s)', $value); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -41,7 +43,8 @@ function () {} function ($className) { return sprintf('($className = %s) && $value instanceof $className', $className); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -49,7 +52,8 @@ function () {} function ($alias, $args = '[]') { return sprintf('$container->get(\'overblog_graphql.resolver_resolver\')->resolve([%s, %s])', $alias, $args); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -60,7 +64,8 @@ function ($mutateAndGetPayload) { return $code; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -71,7 +76,8 @@ function ($mutateAndGetPayload) { return $code; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -82,7 +88,8 @@ function ($idFetcher) { return $code; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -93,7 +100,8 @@ function ($resolveSingleInput) { return $code; }, - function () {} + function () { + } ), new ExpressionFunction( @@ -101,7 +109,8 @@ function () {} function ($alias, $args = '[]') { return sprintf('$container->get(\'overblog_graphql.mutation_resolver\')->resolve([%s, %s])', $alias, $args); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -115,7 +124,8 @@ function ($id, $typeName = null) { $id ); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -126,7 +136,8 @@ function ($globalId) { $globalId ); }, - function () {} + function () { + } ), new ExpressionFunction( @@ -134,7 +145,8 @@ function () {} function ($className, $args = '[]') { return sprintf('(new \ReflectionClass(%s))->newInstanceArgs(%s)', $className, $args); }, - function () {} + function () { + } ), ]; } diff --git a/Generator/TypeGenerator.php b/Generator/TypeGenerator.php index c1e653668..51eeb13e1 100644 --- a/Generator/TypeGenerator.php +++ b/Generator/TypeGenerator.php @@ -54,7 +54,7 @@ public function setCacheDir($cacheDir) protected function generateClassDocBlock(array $value) { - return <<cursor : null, - $lastEdge instanceof Edge ? $lastEdge->cursor : null, + $lastEdge instanceof Edge ? $lastEdge->cursor : null, $last !== null ? $startOffset > $lowerBound : false, $first !== null ? $endOffset < $upperBound : false ) diff --git a/Relay/Connection/Output/Edge.php b/Relay/Connection/Output/Edge.php index 40a93a7d0..7da806012 100644 --- a/Relay/Connection/Output/Edge.php +++ b/Relay/Connection/Output/Edge.php @@ -13,10 +13,10 @@ final class Edge { - /** @var string */ + /** @var string */ public $cursor; - /** @var mixed */ + /** @var mixed */ public $node; public function __construct($cursor, $node) diff --git a/Relay/Connection/Output/PageInfo.php b/Relay/Connection/Output/PageInfo.php index 54f157345..e2f645f9a 100644 --- a/Relay/Connection/Output/PageInfo.php +++ b/Relay/Connection/Output/PageInfo.php @@ -13,16 +13,16 @@ final class PageInfo { - /** @var string */ + /** @var string */ public $startCursor; - /** @var string */ + /** @var string */ public $endCursor; - /** @var bool */ + /** @var bool */ public $hasPreviousPage; - /** @var bool */ + /** @var bool */ public $hasNextPage; public function __construct($startCursor, $endCursor, $hasPreviousPage, $hasNextPage) diff --git a/Relay/Mutation/MutationFieldDefinition.php b/Relay/Mutation/MutationFieldDefinition.php index 04c040e2f..473180abb 100644 --- a/Relay/Mutation/MutationFieldDefinition.php +++ b/Relay/Mutation/MutationFieldDefinition.php @@ -36,7 +36,7 @@ public function toMappingDefinition(array $config) private function cleanMutateAndGetPayload($mutateAndGetPayload) { - if (is_string($mutateAndGetPayload) && 0 === strpos($mutateAndGetPayload, '@=')) { + if (is_string($mutateAndGetPayload) && 0 === strpos($mutateAndGetPayload, '@=')) { $cleanMutateAndGetPayload = substr($mutateAndGetPayload, 2); } else { $cleanMutateAndGetPayload = json_encode($mutateAndGetPayload); diff --git a/Relay/Node/PluralIdentifyingRootFieldDefinition.php b/Relay/Node/PluralIdentifyingRootFieldDefinition.php index 79cc09d9a..1c74923c8 100644 --- a/Relay/Node/PluralIdentifyingRootFieldDefinition.php +++ b/Relay/Node/PluralIdentifyingRootFieldDefinition.php @@ -47,7 +47,7 @@ public function toMappingDefinition(array $config) private function cleanResolveSingleInput($resolveSingleInput) { - if (is_string($resolveSingleInput) && 0 === strpos($resolveSingleInput, '@=')) { + if (is_string($resolveSingleInput) && 0 === strpos($resolveSingleInput, '@=')) { $cleanResolveSingleInput = substr($resolveSingleInput, 2); } else { $cleanResolveSingleInput = json_encode($resolveSingleInput); diff --git a/Request/Executor.php b/Request/Executor.php index 68533e6ce..85209a75a 100644 --- a/Request/Executor.php +++ b/Request/Executor.php @@ -61,12 +61,14 @@ public function addSchema($name, Schema $schema) public function enabledDebugInfo() { $this->hasDebugInfo = true; + return $this; } public function disabledDebugInfo() { $this->hasDebugInfo = false; + return $this; } diff --git a/Tests/DIContainerMockTrait.php b/Tests/DIContainerMockTrait.php index 007388b89..8a69cfa83 100644 --- a/Tests/DIContainerMockTrait.php +++ b/Tests/DIContainerMockTrait.php @@ -12,7 +12,7 @@ namespace Overblog\GraphQLBundle\Tests; /** - * Class DIContainerMockTrait + * Class DIContainerMockTrait. * * @method \PHPUnit_Framework_MockObject_MockBuilder getMockBuilder (string $className) */ diff --git a/Tests/DependencyInjection/OverblogGraphQLTypesExtensionTest.php b/Tests/DependencyInjection/OverblogGraphQLTypesExtensionTest.php index 2027802c8..b2342ca14 100644 --- a/Tests/DependencyInjection/OverblogGraphQLTypesExtensionTest.php +++ b/Tests/DependencyInjection/OverblogGraphQLTypesExtensionTest.php @@ -94,12 +94,12 @@ public function testCustomExceptions() 'definitions' => [ 'exceptions' => [ 'warnings' => [ - 'Symfony\Component\Routing\Exception\ResourceNotFoundException' + 'Symfony\Component\Routing\Exception\ResourceNotFoundException', ], 'errors' => [ - 'InvalidArgumentException' + 'InvalidArgumentException', ], - ] + ], ], ], ], diff --git a/Tests/Error/ErrorHandlerTest.php b/Tests/Error/ErrorHandlerTest.php index de1392670..09bfcaa30 100644 --- a/Tests/Error/ErrorHandlerTest.php +++ b/Tests/Error/ErrorHandlerTest.php @@ -141,7 +141,7 @@ public function testMaskErrorWithoutWrappedExceptionAndThrowExceptionSetToTrue() public function testConvertExceptionToUserWarning() { - $errorHandler = new ErrorHandler(null, null, ["InvalidArgumentException" => 'Overblog\\GraphQLBundle\\Error\\UserWarning']); + $errorHandler = new ErrorHandler(null, null, ['InvalidArgumentException' => 'Overblog\\GraphQLBundle\\Error\\UserWarning']); $executionResult = new ExecutionResult( null, diff --git a/Tests/Functional/Controller/GraphControllerTest.php b/Tests/Functional/Controller/GraphControllerTest.php index 19fb7d9ac..4307240ac 100644 --- a/Tests/Functional/Controller/GraphControllerTest.php +++ b/Tests/Functional/Controller/GraphControllerTest.php @@ -15,7 +15,7 @@ class GraphControllerTest extends TestCase { - private $friendsQuery = <<assertEquals(['data' => $this->expectedData], json_decode($result, true), $result); } - public function graphQLEndpointUriProvider() { return [ @@ -111,10 +110,10 @@ public function testEndpointActionWithVariables() { $client = static::createClient(['test_case' => 'connection']); - $query = << 'connection']); - $query = << 'connection']); - $query = << 2, 'column' => 5, - ] + ], ], ], ]; diff --git a/Tests/Functional/Relay/Connection/ConnectionTest.php b/Tests/Functional/Relay/Connection/ConnectionTest.php index dc65553f7..f8054537e 100644 --- a/Tests/Functional/Relay/Connection/ConnectionTest.php +++ b/Tests/Functional/Relay/Connection/ConnectionTest.php @@ -29,7 +29,7 @@ protected function setUp() public function testIncludesConnectionAndEdgeFields() { - $query = << function () { return false; }, - ] - ] + ], + ], ]); $this->executor->addSchema('global', new Schema(['query' => $queryType])); From a057352a2baac90ce5f43afa954723686fea446f Mon Sep 17 00:00:00 2001 From: Jeremiah VALERIE Date: Tue, 4 Oct 2016 17:31:49 +0200 Subject: [PATCH 3/3] Fix sf 3.0 deprecations error --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 3e1be17e0..482f7c971 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -30,6 +30,7 @@ +