Encode get query params for test
This commit is contained in:
parent
d3565b673e
commit
37c832134b
|
@ -76,9 +76,17 @@ App::post('/v1/graphql/upload')
|
||||||
->inject('schema')
|
->inject('schema')
|
||||||
->action(Closure::fromCallable('graphqlRequest'));
|
->action(Closure::fromCallable('graphqlRequest'));
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Execute a GraphQL request
|
||||||
|
*
|
||||||
|
* @param array $query
|
||||||
|
* @param Request $request
|
||||||
|
* @param Response $response
|
||||||
|
* @param CoroutinePromiseAdapter $promiseAdapter
|
||||||
|
* @param Type\Schema $schema
|
||||||
|
* @return void
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
* @throws \Exception
|
|
||||||
*/
|
*/
|
||||||
function graphqlRequest(
|
function graphqlRequest(
|
||||||
array $query,
|
array $query,
|
||||||
|
@ -141,7 +149,7 @@ function graphqlRequest(
|
||||||
$promiseAdapter->all($promises)->then(
|
$promiseAdapter->all($promises)->then(
|
||||||
function (array $results) use (&$output, &$wg, $debugFlags) {
|
function (array $results) use (&$output, &$wg, $debugFlags) {
|
||||||
try {
|
try {
|
||||||
processResult($results, $output, $debugFlags);
|
$output = processResult($results, $debugFlags);
|
||||||
} finally {
|
} finally {
|
||||||
$wg->done();
|
$wg->done();
|
||||||
}
|
}
|
||||||
|
@ -196,16 +204,15 @@ function parseMultipartRequest(array $query, Request $request): array
|
||||||
* Process an array of results for output
|
* Process an array of results for output
|
||||||
*
|
*
|
||||||
* @param $result
|
* @param $result
|
||||||
* @param $output
|
|
||||||
* @param $debugFlags
|
* @param $debugFlags
|
||||||
* @return void
|
* @return array
|
||||||
*/
|
*/
|
||||||
function processResult($result, &$output, $debugFlags): void
|
function processResult($result, $debugFlags): array
|
||||||
{
|
{
|
||||||
if (!isset($result[1])) {
|
if (!isset($result[1])) {
|
||||||
$output = $result[0]->toArray($debugFlags);
|
return $result[0]->toArray($debugFlags);
|
||||||
} else {
|
} else {
|
||||||
$output = \array_merge_recursive(...\array_map(
|
return \array_merge_recursive(...\array_map(
|
||||||
static fn ($item) => $item->toArray($debugFlags),
|
static fn ($item) => $item->toArray($debugFlags),
|
||||||
$result
|
$result
|
||||||
));
|
));
|
||||||
|
|
|
@ -16,7 +16,7 @@ class GraphQLLocalizationTest extends Scope
|
||||||
public function testGetLocale(): array
|
public function testGetLocale(): array
|
||||||
{
|
{
|
||||||
$projectId = $this->getProject()['$id'];
|
$projectId = $this->getProject()['$id'];
|
||||||
$query = $this->getQuery(self::$GET_LOCALE);
|
$query = \urlencode($this->getQuery(self::$GET_LOCALE));
|
||||||
|
|
||||||
$locale = $this->client->call(Client::METHOD_GET, '/graphql?query=' . $query, \array_merge([
|
$locale = $this->client->call(Client::METHOD_GET, '/graphql?query=' . $query, \array_merge([
|
||||||
'content-type' => 'application/json',
|
'content-type' => 'application/json',
|
||||||
|
|
Loading…
Reference in a new issue