Skip to content

Commit 8b420bb

Browse files
author
kshitij verma
committed
added phpunit test cases
1 parent e3ce33d commit 8b420bb

16 files changed

+893
-533
lines changed

.phpunit.result.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
C:37:"PHPUnit\Runner\DefaultTestResultCache":150:{a:2:{s:7:"defects";a:1:{s:39:"Shopify\Test\PrivateAppTest::testClient";i:4;}s:5:"times";a:1:{s:39:"Shopify\Test\PrivateAppTest::testClient";d:0.003;}}}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ php:
66
- 7.2
77
before_script:
88
- composer install --prefer-source --no-interaction --dev
9-
script: php ./test/index.php
9+
script: php ./phpunit.xml

README.md

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[![Latest Stable Version](https://poser.pugx.org/shopifychamp/shopify-api-php-sdk/v/stable)](https://packagist.org/packages/shopifychamp/shopify-api-php-sdk)
55
[![License](https://poser.pugx.org/shopifychamp/shopify-api-php-sdk/license)](https://packagist.org/packages/shopifychamp/shopify-api-php-sdk)
66

7-
PHP SDK helps to connect with shopify [Custom App](https://shopify.dev/concepts/apps#custom-apps), [Public App](https://shopify.dev/concepts/apps#public-apps) and [Private App](https://shopify.dev/concepts/apps#private-apps) using [REST Api](https://shopify.dev/docs/admin-api/rest/reference) and [Graphql](https://shopify.dev/docs/admin-api/graphql/reference).
7+
PHP SDK helps to connect with shopify [Public App](https://shopify.dev/concepts/apps#public-apps) and [Private App](https://shopify.dev/concepts/apps#private-apps) using [REST Api](https://shopify.dev/docs/admin-api/rest/reference) and [Graphql](https://shopify.dev/docs/admin-api/graphql/reference).
88
* Call GET, POST, PUT and DELETE RestApi method.
99
* Process GraphQL Admin API for [Query root](https://shopify.dev/docs/admin-api/graphql/reference/queryroot) and [Mutations](https://shopify.dev/docs/admin-api/graphql/reference/mutation).
1010
* Queryroot is used to get resources and mutations is used to update resources (products/orders/customers).
@@ -72,30 +72,6 @@ $ composer require shopifychamp/shopify-api-php-sdk
7272
header('Location: '.urldecode($client->prepareAuthorizeUrl($redirect_url)));
7373
}
7474
```
75-
#### 3. For Custom App (Under Development)
76-
Note: Oauth process is similar to public app. To authenticate with Shopify by using a custom app, you need to generate an [installation link](https://shopify.dev/tutorials/authenticate-a-custom-app-with-oauth#create-a-custom-app-and-generate-an-installation-link) from your Partner Dashboard.
77-
* To create instance of `Client` class, need `shop`, `api_key`, `api_secret_key` of custom app.
78-
79-
```
80-
<?php
81-
require(__DIR__ . '/../vendor/autoload.php');
82-
use Shopify\PuplicApp;
83-
84-
$api_params['version'] = '2019-10';
85-
$client = new Shopify\PublicApp($shop, $api_key, $api_secret_key, $api_params);
86-
```
87-
* Copy link from `Merchant install link` section in Custom App and run in browser then it redirect to your url provied provided while creating custom app.
88-
```
89-
if(isset($_GET['code']))
90-
{
91-
//get access_token after authorization of public app
92-
if($access_token = $client->getAccessToken($_GET)){
93-
//set access_token for api call
94-
$client->setAccessToken($access_token);
95-
$response = $client->call('GET','products',['limit'=>250]);
96-
}
97-
}
98-
```
9975
### Call REST Api
10076
* Get Products with limit 250 with `call()` function
10177
```

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
}
1313
],
1414
"require": {
15-
"php": ">=7.0.*",
15+
"php": ">=7.0",
1616
"rdx/graphql-query" : "^1.1",
1717
"guzzlehttp/guzzle": "^6.3",
18-
"phpunit/phpunit": "^8.5"
18+
"phpunit/phpunit": "^6.5"
1919
},
2020
"autoload": {
2121
"psr-4": {

0 commit comments

Comments
 (0)