forked from mghoneimy/php-graphql-oqm
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Using custom namespace for codegen files, and updating tests
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* Testing custom namespace codegen. | ||
* | ||
* 1) Start your GraphQL server with the `ping` query. | ||
* For more info on running your own GraphQL server, see https://www.apollographql.com/ | ||
* | ||
* 2) Run the following command and make sure to use `testing\GraphQL\SchemaObject` as the custom namespace: | ||
* $ php bin/generate_schema_objects | ||
* | ||
* 3) Update composer maps | ||
* $ composer dump-autoload | ||
* | ||
* 4) Run this command: | ||
* $ php examples/ping_query_example.php | ||
* | ||
* You should see the output of the returned query. | ||
*/ | ||
|
||
require_once __DIR__ . '/../vendor/autoload.php'; | ||
|
||
use testing\GraphQL\SchemaObject\RootQueryObject; | ||
use GraphQL\Client; | ||
|
||
const API_URL = 'http://localhost:8080/'; | ||
$client = new Client(API_URL); | ||
|
||
$root = new RootQueryObject(); | ||
$root->selectPing(); | ||
|
||
$result = $client->runQuery($root->getQuery()); | ||
|
||
print_r(['r' => $result]); |