dataloader-php
dataloader-php copied to clipboard
Argument 1 passed to GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter::wait() must be an instance of GraphQL\Executor\Promise\Promise, instance of GuzzleHttp\Promise\Promise given, called
I think I discovered a bug in Dataloader.
It has a static variable Dataloader::$instances where it keeps instances of itself. On __destruct the instance that destructs is taken out of the $instances array.
I have now a weird situation where I run a full test suite that runs both functional tests and unit tests.
First, a functional tests runs, and later I run a unit test that calls MyLoader::await($promise);.
That one fails with this error:
TypeError : Argument 1 passed to GraphQL\Executor\Promise\Adapter\SyncPromiseAdapter::wait() must be an instance of GraphQL\Executor\Promise\Promise, instance of GuzzleHttp\Promise\Promise given, called in /Volumes/CS/www/vendor/overblog/dataloader-php/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php on line 126
/Volumes/CS/www/vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromiseAdapter.php:144
/Volumes/CS/www/vendor/overblog/dataloader-php/lib/promise-adapter/src/Adapter/WebonyxGraphQLSyncPromiseAdapter.php:126
/Volumes/CS/www/vendor/overblog/dataloader-php/src/DataLoader.php:282
/Volumes/CS/www/tests/Infrastructure/GraphQL/Resolver/PlatformAccountResolverTest.php:60
Somehow, the previous instance is not cleaned up nicely.
How to solve this?