Skip to content

Commit 8c52411

Browse files
committed
Test Automation support added
1 parent e8033ca commit 8c52411

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

test/EntriesTest.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
class EntriesTest extends TestCase {
1212
public static $rest;
1313
public static $Stack;
14+
public static $_uid;
1415
/*
1516
* Setup before the test suites executes
1617
* @test
1718
*/
1819
public static function setUpBeforeClass() : void {
1920
self::$rest = new REST();
2021
self::$Stack = Contentstack\Contentstack::Stack(self::$rest->getAPIKEY(), self::$rest->getAccessToken(), self::$rest->getEnvironmentName());
21-
Utility::debug(is_null(self::$rest->getHost()));
2222
if (self::$rest->getHost() !== NULL) {
2323
self::$Stack->setHost(self::$rest->getHost());
2424
}
@@ -37,19 +37,17 @@ public function testFind() {
3737
$this->assertArrayHasKey(0, $_entries);
3838
$this->assertTrue((count($_entries[0]) === ENTRY_COUNT));
3939
$this->assertTrue(checkEntriesSorting($_entries[0]));
40-
}
41-
42-
public function testFindOne() {
43-
$_entry = self::$Stack->ContentType(CT_ContentType)->Query()->toJSON()->findOne();
44-
// $this->assertObjectHasAttribute('object', $_entry);
45-
$this->assertEquals($_entry['title'], getResultEntries(CT_ContentType, ENTRY_COUNT - 1)['title']);
40+
for($i = 0; $i < count($_entries[0]); $i++) {
41+
if ($_entries[0][$i]['title'] === 'CB1-10') {
42+
self::$_uid = $_entries[0][$i]['uid'];
43+
}
44+
}
4645
}
4746

4847
public function testFetch() {
49-
$_object = getResultEntries(CT_ContentType, 0);
50-
$_uid = $_object['uid'];
51-
$_entry = self::$Stack->ContentType(CT_ContentType)->Entry($_uid)->toJSON()->fetch();
52-
$this->assertEquals($_entry['title'], $_object['title']);
48+
$_entry = self::$Stack->ContentType(CT_ContentType)->Entry(self::$_uid)->toJSON()->fetch();
49+
print_r($_entry['title']);
50+
$this->assertEquals($_entry['title'], 'CB1-10');
5351
}
5452

5553
public function testAddParam() {

0 commit comments

Comments
 (0)