Skip to content

Conversation

rpander93
Copy link
Contributor

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Documented? no
Fixed tickets #163
License MIT

Makes the batching method configurable. Apollo just wants the plain payload without any id attached to it. Not sure how to properly test the code since it requires switching a config value at run-time which is not possible as I just found out..

/**
 * @param $uri
 * @dataProvider graphQLBatchEndpointUriProvider
 */
public function testBatchEndpointApolloStyleAction($uri)
{
	$client = static::createClient(['test_case' => 'connection']);

	$data = [
		[
			'query' => $this->friendsQuery
		],
		[
			'query' => $this->friendsTotalCountQuery
		]
	];

	$client->request('POST', $uri, [], [], ['CONTENT_TYPE' => 'application/json'], json_encode($data));
	$result = $client->getResponse()->getContent();

	$expected = [
		['data' => $this->expectedData],
		['data' => ['user' => ['friends' => ['totalCount' => 4]]]]
	];
	$this->assertEquals($expected, json_decode($result, true), $result);
}

@lucasfeliciano
Copy link

I need this so much. 😄

@mcg-web
Copy link
Contributor

mcg-web commented Jul 21, 2017

Thank you for this contribution @rpander93. The best way to test this right now is to add a new test case in config that inherits the connection config and override the batching_method then test it in a new test... Can you also provide some documentation please?

@rpander93
Copy link
Contributor Author

Ok, I added the documentation. I dont get you on the testing stuff unfortunately.

@rpander93 rpander93 closed this Jul 21, 2017
@rpander93 rpander93 reopened this Jul 21, 2017
Copy link
Contributor

@mcg-web mcg-web left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add tests later. Need document for the way to add functional tests. Thanks again for contribution 👍

@mcg-web mcg-web merged commit acbba86 into overblog:master Jul 24, 2017
@lucasfeliciano
Copy link

lucasfeliciano commented Jul 24, 2017

🎉

When this will be released?

@rpander93 rpander93 deleted the switch_batching_style branch July 24, 2017 16:52
@rpander93
Copy link
Contributor Author

Great, thanks!

@mcg-web
Copy link
Contributor

mcg-web commented Jul 25, 2017

@lucasfeliciano no release date right now but you can use 0.9-dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants