You are here

protected function MockingTrait::toBoundPromise in GraphQL 8.4

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.

File

tests/src/Traits/MockingTrait.php, line 72

Class

MockingTrait
Contains helpers for setting up mock servers and schemas for testing.

Namespace

Drupal\Tests\graphql\Traits

Code

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