Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ env:
- SIMPLETEST_DB=mysql://root:@127.0.0.1/graphql
- TRAVIS=true
matrix:
- DRUPAL_CORE=8.8.x
- DRUPAL_CORE=9.0.x
- DRUPAL_CORE=8.9.x
- DRUPAL_CORE=8.8.x

matrix:
# Don't wait for the allowed failures to build.
Expand All @@ -28,6 +29,17 @@ matrix:
- DRUPAL_CORE=8.8.x
# Only run code coverage on the latest php and drupal versions.
- WITH_PHPDBG_COVERAGE=true
# Drupal 9 requires PHP 7.3 or higher
exclude:
- php: 7.0
env:
- DRUPAL_CORE=9.0.x
- php: 7.1
env:
- DRUPAL_CORE=9.0.x
- php: 7.2
env:
- DRUPAL_CORE=9.0.x
allow_failures:
# Allow the code coverage report to fail.
- php: 7.3
Expand Down
2 changes: 1 addition & 1 deletion graphql.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ type: module
description: 'Base module for integrating GraphQL with Drupal.'
package: GraphQL
configure: graphql.config_page
core: 8.x
core_version_requirement: ^8.8 || ^9
5 changes: 2 additions & 3 deletions modules/graphql_core/graphql_core.info.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: GraphQL Core
type: module
description: 'Provides type system plugins and derivers on behalf of core modules.'
package: GraphQL
core: 8.x
package: Testing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This is not a 'Testing' package - it is a normal submodule that is meant to be installed by users.

dependencies:
- graphql
- graphql
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this is small, but we should be using the new format for dependencies, graphql:graphql

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 'GraphQL Test: Blocks'
type: module
core: 8.x
core_version_requirement: ^8.8 || ^9
dependencies:
- block
- block_content
Comment on lines 5 to 6
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ name: GraphQL Breadcrumbs test
type: module
description: 'Test for breadcrumbs.'
package: GraphQL
core: 8.x
core_version_requirement: ^8.8 || ^9
dependencies:
- graphql_breadcrumbs
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Context Test
description: Test contexts in graphql schema.
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9
hidden: TRUE
dependencies:
- graphql_core
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Requests Test
description: Dummy callbacks for internal request testing.
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9
hidden: TRUE
dependencies:
- graphql_core
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: 'GraphQL Tests: Menu'
type: module
core: 8.x
core_version_requirement: ^8.8 || ^9
dependencies:
- system
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again.

Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ protected function setUp() {
parent::setUp();

/** @var \Drupal\Core\Config\Entity\ConfigEntityStorageInterface $languageStorage */
$languageStorage = $this->container->get('entity.manager')->getStorage('configurable_language');
$languageStorage = $this->container->get('entity_type.manager')->getStorage('configurable_language');

$language = $languageStorage->create([
'id' => $this->chineseSimplifiedLangcode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class GraphQLCoreTestBase extends GraphQLTestBase {
*/
public static $modules = [
'graphql_core',
'path_alias',
'user',
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function testImageField() {
'image' => [[
'alt' => $a->image->alt,
'title' => $a->image->title,
'entity' => ['url' => $a->image->entity->url()],
'entity' => ['url' => $a->image->entity->createFileUrl(FALSE)],
'width' => $a->image[0]->width,
'height' => $a->image[0]->height,
'thumbnailImage' => [
Expand Down
2 changes: 1 addition & 1 deletion modules/graphql_core/tests/src/Kernel/Menu/MenuTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testTestSetup() {
/** @var \Drupal\Core\Menu\MenuTreeStorageInterface $menuStorage */
$menuStorage = $this->container->get('entity_type.manager')->getStorage('menu');
$menu = $menuStorage->load('test');
$this->assertTrue($menu);
$this->assertIsObject($menu);

/** @var \Drupal\Core\Menu\MenuLinkTreeInterface $menuTree */
$menuTree = $this->container->get('menu.link_tree');
Expand Down
2 changes: 1 addition & 1 deletion src/Form/EntityQueryMapImportForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public function save(array $form, FormStateInterface $formState) {
$entity->set('map', array_flip((array) json_decode($json)));
$entity->save();

drupal_set_message($this->t('Saved the query map version %id.', [
$this->messenger()->addMessage($this->t('Saved the query map version %id.', [
'%id' => $entity->id(),
]));

Expand Down
18 changes: 8 additions & 10 deletions src/Routing/QueryRouteEnhancer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@
namespace Drupal\graphql\Routing;

use Drupal\Component\Utility\NestedArray;
use Drupal\Core\Routing\Enhancer\RouteEnhancerInterface;
use Drupal\graphql\GraphQL\QueryProvider\QueryProviderInterface;
use Drupal\Core\Routing\EnhancerInterface;
use Drupal\graphql\Utility\JsonHelper;
use GraphQL\Server\Helper;
use Symfony\Cmf\Component\Routing\RouteObjectInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Route;

class QueryRouteEnhancer implements RouteEnhancerInterface {

/**
* {@inheritdoc}
*/
public function applies(Route $route) {
return $route->hasDefault('_graphql');
}
class QueryRouteEnhancer implements EnhancerInterface {

/**
* {@inheritdoc}
*/
public function enhance(array $defaults, Request $request) {
$route = $defaults[RouteObjectInterface::ROUTE_OBJECT];
if (!$route->hasDefault('_graphql')) {
return $defaults;
}

$helper = new Helper();
$method = $request->getMethod();
$body = $this->extractBody($request);
Expand Down
2 changes: 1 addition & 1 deletion tests/modules/graphql_enum_test/graphql_enum_test.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Enumeration Test
description: Test enumeration plugins.
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9
hidden: TRUE
dependencies:
- graphql
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Override Test
description: Test plugin overrides in graphql schema.
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9
hidden: TRUE
dependencies:
- graphql_plugin_test
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Plugin Test
description: Test plugin based graphql schema.
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9
hidden: TRUE
dependencies:
- graphql
2 changes: 1 addition & 1 deletion tests/modules/graphql_test/graphql_test.info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ type: module
name: GraphQL Test
description: Provides a default schema plugin for testing.
package: Testing
core: 8.x
core_version_requirement: ^8.8 || ^9
hidden: TRUE
dependencies:
- graphql
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...

3 changes: 2 additions & 1 deletion tests/src/Kernel/Framework/UploadMutationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class UploadMutationTest extends GraphQLTestBase {
*/
public function testFileUpload() {
// Create dummy file, since symfony will test if it exists..
$file = file_directory_temp() . '/graphql_upload_test.txt';
$file = \Drupal::service('file_system')
->getTempDirectory() . '/graphql_upload_test.txt';
touch($file);

// Mock a mutation that accepts the upload input and just returns
Expand Down
4 changes: 0 additions & 4 deletions tests/src/Kernel/GraphQLTestBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
use Drupal\Tests\graphql\Traits\MockGraphQLPluginTrait;
use Drupal\Tests\graphql\Traits\QueryFileTrait;
use Drupal\Tests\graphql\Traits\QueryResultAssertionTrait;
use PHPUnit_Framework_Error_Notice;
use PHPUnit_Framework_Error_Warning;

/**
* Base class for GraphQL tests.
Expand Down Expand Up @@ -102,8 +100,6 @@ protected function setUp() {
parent::setUp();
$this->injectTypeSystemPluginManagers($this->container);

PHPUnit_Framework_Error_Warning::$enabled = FALSE;

$this->injectAccount();
$this->installConfig('system');
$this->installConfig('graphql');
Expand Down
8 changes: 4 additions & 4 deletions tests/src/Traits/MockGraphQLPluginTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ protected function mockFieldFactory($definition, $result = NULL, $builder = NULL
* @param mixed|null $applies
* A result for the types "applies" method. Defaults to `TRUE`.
*
* @return \PHPUnit_Framework_MockObject_MockObject
* @return \PHPUnit\Framework\MockObject\MockObject
* The type mock object.
*/
protected function mockType($id, array $definition, $applies = TRUE, $builder = NULL) {
Expand Down Expand Up @@ -463,7 +463,7 @@ protected function mockInputTypeFactory($definition, $builder) {
* A result for this mutation. Can be a value or a callback. If omitted, no
* resolve method mock will be attached.
*
* @return \PHPUnit_Framework_MockObject_MockObject
* @return \PHPUnit\Framework\MockObject\MockObject
* The mutation mock object.
*/
protected function mockMutation($id, array $definition, $result = NULL, $builder = NULL) {
Expand Down Expand Up @@ -513,7 +513,7 @@ protected function mockMutationFactory($definition, $result = NULL, $builder = N
* @param array $definition
* The plugin definition. Will be merged with the interface defaults.
*
* @return \PHPUnit_Framework_MockObject_MockObject
* @return \PHPUnit\Framework\MockObject\MockObject
* The interface mock object.
*/
protected function mockInterface($id, array $definition, $builder = NULL) {
Expand Down Expand Up @@ -555,7 +555,7 @@ protected function mockInterfaceFactory($definition, $builder = NULL) {
* @param array $definition
* The plugin definition. Will be merged with the union defaults.
*
* @return \PHPUnit_Framework_MockObject_MockObject
* @return \PHPUnit\Framework\MockObject\MockObject
* The union mock object.
*/
protected function mockUnion($id, array $definition, $builder = NULL) {
Expand Down