protected function PersistedQueriesTest::setUp in GraphQL 8.4
Overrides GraphQLTestBase::setUp
File
- tests/
src/ Kernel/ Framework/ PersistedQueriesTest.php, line 24
Class
- PersistedQueriesTest
- Tests the entire query result pipeline when using persisted queries.
Namespace
Drupal\Tests\graphql\Kernel\FrameworkCode
protected function setUp() : void {
parent::setUp();
$schema = <<<GQL
schema {
query: Query
}
type Query {
field_one: String
field_two: String
field_three: Link
}
type Link {
url: String
title: String
}
GQL;
$this
->setUpSchema($schema);
$this
->mockResolver('Query', 'field_one', 'this is the field one');
$this
->mockResolver('Query', 'field_two', 'this is the field two');
$this
->mockResolver('Query', 'field_three', []);
$this
->mockResolver('Link', 'url', 'https://www.ecosia.org');
$this
->mockResolver('Link', 'title', 'Ecosia');
/** @var \Drupal\graphql\Plugin\DataProducerPluginManager $manager */
$manager = $this->container
->get('plugin.manager.graphql.persisted_query');
$this->plugin_one = $manager
->createInstance('persisted_query_plugin_one');
$this->plugin_two = $manager
->createInstance('persisted_query_plugin_two');
$this->plugin_three = $manager
->createInstance('persisted_query_plugin_three');
}