Skip to content

Commit 096bdc5

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

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ $ composer require shopifychamp/shopify-api-php-sdk
8888
```
8989
if($client->hasNextPage())
9090
{
91-
$next_page_response $client->call('GET','products',['limit'=>20,'page_info'=>$client->getNextPage()]);
91+
$next_page_response = $client->call('GET','products',['limit'=>20,'page_info'=>$client->getNextPage()]);
9292
print_r($next_page_response);
9393
}
9494
```
@@ -98,7 +98,7 @@ $ composer require shopifychamp/shopify-api-php-sdk
9898
```
9999
if($client->hasPrevPage())
100100
{
101-
$prev_page_response $client->call('GET','products',['limit'=>20,'page_info'=>$client->getPrevPage()]);
101+
$prev_page_response = $client->call('GET','products',['limit'=>20,'page_info'=>$client->getPrevPage()]);
102102
print_r($prev_page_response);
103103
}
104104
```

test/privateapp.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,14 @@
1212
$client = new Shopify\PrivateApp($shop, $api_key, $password, $api_params);
1313
/**rest api call**/
1414
$response = $client->call('GET', 'products', ['limit' => 1]);
15-
print_r($response);
15+
if($client->hasNextPage()){
16+
$response = $client->call('GET','products',[
17+
'limit'=>20,
18+
'page_info'=>$client->getNextPage()
19+
]);
20+
print_r($response);
21+
}
22+
1623
}
1724
catch (\Shopify\Exception\ApiException $e)
1825
{

test/publicapp.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@
1717
{
1818
if($access_token = $client->getAccessToken($_GET)){
1919
$client->setAccessToken($access_token);
20-
print_r($access_token);
20+
$response = $client->call('GET', 'products', ['limit' => 1]);
21+
if($client->hasNextPage()){
22+
$response = $client->call('GET','products',[
23+
'limit'=>20,
24+
'page_info'=>$client->getNextPage()
25+
]);
26+
print_r($response);
27+
}
2128
}
29+
2230
}else{
2331
$redirect_url= isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"] == "on"?'https://':'http://';
2432
if ($_SERVER["SERVER_PORT"] != "80") {
@@ -29,8 +37,6 @@
2937

3038
header('Location: '.urldecode($client->prepareAuthorizeUrl($redirect_url)));
3139
}
32-
33-
3440
}catch (\Shopify\Exception\ApiException $e){
3541
echo "Errors: ".$e->getError().'<br> status code: '.$e->getCode();
3642
}

0 commit comments

Comments
 (0)