You are here

protected function MockGraphQLPluginTrait::toPromise in GraphQL 8.3

Turn a value into a result promise.

Parameters

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

Return value

\PHPUnit_Framework_MockObject_Stub_ReturnCallback The return callback promise.

1 call to MockGraphQLPluginTrait::toPromise()
MockGraphQLPluginTrait::toBoundPromise in tests/src/Traits/MockGraphQLPluginTrait.php
Turn a value into a bound result promise.

File

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

Class

MockGraphQLPluginTrait
Trait for mocking GraphQL type system plugins.

Namespace

Drupal\Tests\graphql\Traits

Code

protected function toPromise($value) {
  return $this
    ->returnCallback(is_callable($value) ? $value : function () use ($value) {
    (yield $value);
  });
}