Skip to content

Commit 64a9a20

Browse files
Updated in Testcases
1 parent 0d8446d commit 64a9a20

File tree

8 files changed

+14
-14
lines changed

8 files changed

+14
-14
lines changed

src/lib/models/assets.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class Assets {
1818

1919
var $stack = '';
20-
20+
2121

2222
/*
2323
* Assets
@@ -31,7 +31,7 @@ public function __construct($stack = '') {
3131
}
3232

3333
public function Query() {
34-
return new Query($this);
34+
return new Query($this, $this->type);
3535
}
3636

3737
}

src/lib/models/base_query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ abstract class BaseQuery {
1414

1515
public function __construct($data = '', $parent = '') {
1616

17-
\Contentstack\Utility\debug($data);
1817
if($data->type == 'assets'){
1918
$this->assets = $data;
2019
$this->queryObject = $parent;
2120
$this->queryObject->_query = array();
2221
$this->subQuery = array();
2322
}else if ($data->type == 'asset'){
23+
2424
$this->asset = $data;
2525
$this->queryObject = $data;
2626
$this->queryObject->_query = array();

src/lib/models/content_type.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ContentType {
2626
public function __construct($uid = '', $stack = '') {
2727
$this->uid = $uid;
2828
$this->stack = $stack;
29+
$this->type = 'contentType';
2930
}
3031

3132
/*
@@ -43,6 +44,6 @@ public function Entry($entry_uid = '') {
4344
* @returns Query
4445
* */
4546
public function Query() {
46-
return new Query($this);
47+
return new Query($this, $this->type);
4748
}
4849
}

src/lib/models/query.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ class Query extends BaseQuery {
2020
* Query Class to initalize your Query
2121
* @param
2222
* */
23-
public function __construct($data = '') {
23+
public function __construct($data = '', $type = '') {
2424
$this->_query = array();
25+
$this->type = $type;
2526
parent::__construct($data, $this);
2627

2728
}
@@ -32,10 +33,9 @@ public function __construct($data = '') {
3233
* */
3334
public function find() {
3435
$this->operation = __FUNCTION__;
35-
if($this->assets){
36+
if($this->type == 'assets'){
3637
return Utility\request($this, 'assets');
37-
}
38-
else if($this->contentType){
38+
}else if($this->type == 'contentType'){
3939
return Utility\request($this);
4040
}
4141

src/lib/models/result.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ class Result {
1010
* */
1111
public function __construct($result = '') {
1212
$this->object = $result;
13-
// \Contentstack\Utility\debug($this);
13+
14+
1415
}
1516

1617
/*

src/lib/utility.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* */
55
namespace Contentstack\Utility;
66

7-
require_once __DIR__ . "/models/result.php";
7+
require_once __DIR__ . "/models/result.php";
88
require_once __DIR__ . "/models/csexception.php";
99

1010
use Contentstack\Error\CSException;

test/ContentStackTestCases.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ public function testAssetsFind() {
4444

4545
public function testAssetFetch() {
4646
$_object = self::$Stack->Assets()->Query()->toJSON()->find();
47-
//\Contentstack\Utility\debug($_object);
4847
$_uid = $_object[0][0]['uid'];
49-
$_asset = self::$Stack->Asset($_uid)->toJSON()->fetch();
48+
$_asset = self::$Stack->Asset($_uid)->fetch();
5049
$this->assertEquals($_asset->get('title'), $_object[0][0]['title']);
5150
}
5251

test/utility.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ function checkEntriesSorting($entries = array(), $sortKey = 'updated_at', $order
1717
if (!function_exists('assetsSorting')) {
1818

1919
function checkAssetsSorting($assets = array(), $sortKey = 'updated_at', $order = 'desc') {
20-
\Contentstack\Utility\debug($assets);
2120
$result = true;
2221
for($i = 0;$i < count($assets) - 1; $i++) {
2322
if($order === 'desc')
@@ -31,7 +30,7 @@ function checkAssetsSorting($assets = array(), $sortKey = 'updated_at', $order =
3130

3231
if (!function_exists('sortEntries')) {
3332
function sortEntries($entries = array(), $sortKey = 'updated_at', $order = 'desc') {
34-
\Contentstack\Utility\debug(array_column($entries, $sortKey));
33+
3534
usort($entries, create_function('$a, $b', '
3635
$a = $a["' . $sortKey . '"];
3736
$b = $b["' . $sortKey . '"];

0 commit comments

Comments
 (0)