Skip to content

Commit d4f5a26

Browse files
Rohit MishraRohit Mishra
authored andcommitted
updated in test file
1 parent 153bb86 commit d4f5a26

3 files changed

Lines changed: 17 additions & 7 deletions

File tree

examples/index.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,24 +8,18 @@
88
</html>
99
<?php
1010
ini_set('display_errors', 'On');
11-
1211
use Contentstack\Contentstack;
1312
include_once "../src/index.php";
14-
1513
$stack = Contentstack::Stack('<API-KEY>', '<ACCESS-TOKEN>', '<ENVIRONMENT>');
16-
1714
try {
1815
//$result = $stack->ContentType('ctwithallfields')->Query()->addParam('include_dimensions', 'true')->toJSON()->find();
1916
//$result = $stack->ContentType('ctwithallfields')->Query()->addParam('include_dimension', 'true')->toJSON()->find();
2017
//$result = $stack->ContentType('ctwithallfields')->Query()->includeCount('include_dimensions', true)->toJSON()->find();
2118
//$result = $stack->ContentType('ctwithallfields')->Entry('blt8d1ab7600ba4c2b4')->addParam('include_dimensions', true)->toJSON()->fetch();
22-
2319
//$result = $stack->Assets('blt9b5825dd804a9067')->addParam('include_dimension', 'true')->toJSON()->fetch();
2420
// \Contentstack\Utility\debug(($result));
25-
26-
2721
} catch(Exception $e) {
2822
echo "Message : ".$e->getMessage(); // returns message -> API -> error_message
2923
echo "Code : ".$e->getCode(); // returns number -> API -> error_code
3024
echo "Errors : ".print_r($e->getErrors()); // returns array -> API -> errors
31-
}
25+
}

src/lib/utility.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ function wrapResult($result = '', $queryObject = '') {
256256
function contentstackRequest($queryObject = '', $type = ''){
257257
$server_output = '';
258258
if($queryObject) {
259+
// \Contentstack\Utility\debug(contentstackUrl($queryObject, $type));
259260
$http = curl_init(contentstackUrl($queryObject, $type));
260261

261262
// setting the GET request

test/AssetsTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,21 @@ public function testAssetsFindLimit() {
7676
$this->assertTrue(checkAssetsSorting($_assets[0]));
7777
}
7878

79+
public function testAssetsAddParam() {
80+
$_assets = self::$Stack->Assets()->Query()->addParam('include_dimension', 'true')->toJSON()->find();
81+
$_object = self::$Stack->Assets()->Query()->toJSON()->find();
82+
$_uid = $_object[0][0]['uid'];
83+
$_asset = self::$Stack->Assets($_uid)->addParam('include_dimension', 'true')->toJSON()->fetch();
84+
$this->assertTrue(array_key_exists('dimension', $_asset));
85+
}
86+
87+
public function testAssetsmultipleAddParam() {
88+
$_assets = self::$Stack->Assets()->Query()->addParam('include_dimension', 'true')->toJSON()->find();
89+
$this->assertTrue(array_key_exists('dimension', $_assets[0][0]));
90+
91+
}
92+
93+
7994
public function testAssetsFindCount() {
8095
$_assets = self::$Stack->Assets()->Query()->toJSON()->count()->find();
8196
$assets = self::$Stack->Assets()->Query()->toJSON()->find();

0 commit comments

Comments
 (0)