protected function MockingTrait::mockResolver in GraphQL 8.4
Mock data producer field.
Parameters
string $type: Parent Type.
string $field: Field name.
mixed|\Drupal\graphql\GraphQL\Resolver\ResolverInterface $resolver: Resolver.
45 calls to MockingTrait::mockResolver()
- BufferedFieldTest::testBatchedFields in tests/
src/ Kernel/ Framework/ BufferedFieldTest.php - Test if the schema is created properly.
- DisabledResultCacheTest::testDisabledCache in tests/
src/ Kernel/ Framework/ DisabledResultCacheTest.php - Test if disabling the result cache has the desired effect.
- EntityBufferTest::testEntityBuffer in tests/
src/ Kernel/ EntityBufferTest.php - Tests the entity buffer.
- EntityUuidBufferTest::testEntityUuidBuffer in tests/
src/ Kernel/ EntityUuidBufferTest.php - Tests the entity UUID buffer.
- PermissionsTest::setUp in tests/
src/ Kernel/ Framework/ PermissionsTest.php
File
- tests/
src/ Traits/ MockingTrait.php, line 192
Class
- MockingTrait
- Contains helpers for setting up mock servers and schemas for testing.
Namespace
Drupal\Tests\graphql\TraitsCode
protected function mockResolver($type, $field, $resolver = NULL) : void {
if (is_callable($resolver)) {
$resolver = new Callback($resolver);
}
if (!$resolver instanceof ResolverInterface) {
$resolver = new Value($resolver);
}
$this->registry
->addFieldResolver($type, $field, $resolver);
}