-
-
Notifications
You must be signed in to change notification settings - Fork 598
GraphQL API #510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GraphQL API #510
Changes from all commits
08b2a34
3a1dd27
abac056
a79b2b3
dcec042
25d30c1
d31ef0b
eb43204
e9f57e6
0be9dc1
222e775
9f30988
afb9793
21138e6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Github\Api; | ||
|
||
/** | ||
* GraphQL API. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be mention that this is the Early Access program? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
* | ||
* Part of the Github API Early-Access Program | ||
* | ||
* @link https://developer.github.com/early-access/graphql/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be an extra space before this line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
* @author Miguel Piedrafita <soy@miguelpiedrafita.com> | ||
*/ | ||
class GraphQL extends AbstractApi | ||
{ | ||
/** | ||
* @param string $query | ||
* | ||
* @return array | ||
*/ | ||
public function execute($query) | ||
{ | ||
$params = array( | ||
'query' => $query | ||
); | ||
|
||
return $this->post('/graphql', $params); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
namespace Github\Tests\Api; | ||
|
||
class GraphQLTest extends TestCase | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file should have class comment and namespace There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done (I think) |
||
{ | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldTestGraphQL() | ||
{ | ||
$api = $this->getApiMock(); | ||
|
||
$api->expects($this->once()) | ||
->method('post') | ||
->with($this->equalTo('/graphql'), $this->equalTo(['query'=>'bar'])) | ||
->will($this->returnValue('foo')); | ||
|
||
$result = $api->execute('bar'); | ||
$this->assertEquals('foo', $result); | ||
} | ||
|
||
protected function getApiClass() | ||
{ | ||
return \Github\Api\GraphQL::class; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 space line before namespace tag is required