protected function MockingTrait::toPromise in GraphQL 8.4
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 MockingTrait::toPromise()
- MockingTrait::toBoundPromise in tests/
src/ Traits/ MockingTrait.php - Turn a value into a bound result promise.
File
- tests/
src/ Traits/ MockingTrait.php, line 55
Class
- MockingTrait
- Contains helpers for setting up mock servers and schemas for testing.
Namespace
Drupal\Tests\graphql\TraitsCode
protected function toPromise($value) {
return $this
->returnCallback(is_callable($value) ? $value : function () use ($value) {
(yield $value);
});
}