File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ $config = array(
4040 'ShopUrl' => 'yourshop.myshopify.com',
4141 'ApiKey' => '***YOUR-PRIVATE-API-KEY***',
4242 'Password' => '***YOUR-PRIVATE-API-PASSWORD***',
43+ 'AccessToken' => '***YOUR-PRIVATE-API-PASSWORD***', // optional but needed if you want to use graphql
4344);
4445
4546PHPShopify\ShopifySDK::config($config);
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PHPShopify ;
4+
5+ class GraphQLTest extends TestResource
6+ {
7+ /**
8+ * GraphQLTest constructor.
9+ */
10+ public function __construct ()
11+ {
12+ parent ::__construct ();
13+ }
14+
15+
16+ /**
17+ * GraphQL Query Test
18+ */
19+ public function testQuery ()
20+ {
21+ $ graphQL = <<<Query
22+ query {
23+ shop {
24+ name
25+ primaryDomain {
26+ url
27+ host
28+ }
29+ }
30+ }
31+ Query ;
32+
33+ $ return = static ::$ shopify ->GraphQL ->post ($ graphQL );
34+
35+ $ this ->assertNotEmpty ($ return ['data ' ]['shop ' ]);
36+ }
37+
38+
39+ }
Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ public static function setUpBeforeClass()
2323 'ShopUrl ' => getenv ('SHOPIFY_SHOP_URL ' ), //Your shop URL
2424 'ApiKey ' => getenv ('SHOPIFY_API_KEY ' ), //Your Private API Key
2525 'Password ' => getenv ('SHOPIFY_API_PASSWORD ' ), //Your Private API Password
26+ 'AccessToken ' => getenv ('SHOPIFY_API_PASSWORD ' ), //Your Access Token(Private API Password)
2627 );
2728
2829 self ::$ shopify = ShopifySDK::config ($ config );
You can’t perform that action at this time.
0 commit comments