You are here

protected function MockGraphQLPluginTrait::toBoundPromise in GraphQL 8.3

Turn a value into a bound result promise.

Parameters

mixed $value: The return value. Can also be a value callback.

mixed $scope: The resolver's bound object and class scope.

Return value

\PHPUnit_Framework_MockObject_Stub_ReturnCallback The return callback promise.

6 calls to MockGraphQLPluginTrait::toBoundPromise()
EntityMutationTest::mockMutationFactory in modules/graphql_core/tests/src/Kernel/EntityMutation/EntityMutationTest.php
MockGraphQLPluginTrait::mockEnumFactory in tests/src/Traits/MockGraphQLPluginTrait.php
MockGraphQLPluginTrait::mockFieldFactory in tests/src/Traits/MockGraphQLPluginTrait.php
MockGraphQLPluginTrait::mockMutationFactory in tests/src/Traits/MockGraphQLPluginTrait.php
MockGraphQLPluginTrait::mockTypeFactory in tests/src/Traits/MockGraphQLPluginTrait.php

... See full list

File

tests/src/Traits/MockGraphQLPluginTrait.php, line 268

Class

MockGraphQLPluginTrait
Trait for mocking GraphQL type system plugins.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function toBoundPromise($value, $scope) {
  return $this
    ->toPromise(is_callable($value) ? \Closure::bind($value, $scope, $scope) : $value);
}