/** * Test #13. SYNCH request write new object. */ public function testSynchPut() { global $testTripId1, $testName1; global $synchAuthToken; $this->assertEquals(0, $this->countTestRows()); $data = array('tripId' => $testTripId1, 'name' => $testName1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'value' => 'value', 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchTripAttribute.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new TripAttribute($testTripId1, $testName1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }
/** * Test #13. SYNCH request write new object. */ public function testSynchPut() { global $testUserId1; global $synchAuthToken; $this->assertEquals(0, $this->countTestRows()); $data = array('userId' => $testUserId1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'name' => 'Test User', 'externalType' => 'externaltype', 'externalId' => 'externalid', 'access' => 'Y', 'email' => '*****@*****.**', 'notification' => 'Y', 'tempCode' => 'tempcode', 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchUser.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new User($testUserId1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals("Test User", $object->getName()); $this->assertEquals("externaltype", $object->getExternalType()); $this->assertEquals("externalid", $object->getExternalId()); $this->assertEquals("Y", $object->getAccess()); $this->assertEquals("*****@*****.**", $object->getEmail()); $this->assertEquals("Y", $object->getNotification()); $this->assertEquals("tempcode", $object->getTempCode()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }
/** * Extra test. Make sure a large amount of text can be uploaded by * synch. * @depends testSynchPut */ public function testSynchPutLarge() { global $testTripId1; global $synchAuthToken; $largeText = $this->getLargeText(15000); $this->assertEquals(0, $this->countTestRows()); $data = array('tripId' => $testTripId1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'name' => 'Test Trip', 'description' => $largeText, 'bannerImg' => 'test-01.png', 'startDate' => '2015-09-01', 'endDate' => '2015-09-30', 'active' => 'Y', 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchTrip.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new Trip($testTripId1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals("Test Trip", $object->getName()); $this->assertEquals($largeText, $object->getDescription()); $this->assertEquals("test-01.png", $object->getBannerImg()); $this->assertEquals("2015-09-01", $object->getStartDate()); $this->assertEquals("2015-09-30", $object->getEndDate()); $this->assertEquals("Y", $object->getActive()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }
/** * Extra test. Make sure a large amount of text can be uploaded by * synch. * @depends testSynchPut */ public function testSynchPutLarge() { global $testTripId1, $testJournalId1; global $synchAuthToken; $largeText = $this->getLargeText(15000); $this->assertEquals(0, $this->countTestRows()); $data = array('tripId' => $testTripId1, 'journalId' => $testJournalId1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'userId' => 'user', 'journalDate' => '2015-09-30', 'journalTitle' => 'Journal Title', 'journalText' => $largeText, 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchJournal.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new Journal($testTripId1, $testJournalId1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals('user', $object->getUserId()); $this->assertEquals('2015-09-30', $object->getJournalDate()); $this->assertEquals('Journal Title', $object->getJournalTitle()); $this->assertEquals($largeText, $object->getJournalText()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }
/** * Test #13. SYNCH request write new object. */ public function testSynchPut() { global $testTripId1, $testReferenceId1, $testUserId1; global $synchAuthToken; $this->assertEquals(0, $this->countTestRows()); $data = array('tripId' => $testTripId1, 'referenceId' => $testReferenceId1, 'userId' => $testUserId1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'type' => '-type-1', 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchFeedback.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new Feedback($testTripId1, $testReferenceId1, $testUserId1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals('-type-1', $object->getType()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }
public function testGetAuthToken() { global $testUserId, $testPassword; $data = array('userId' => $testUserId, 'password' => $testPassword); $result = putApi('login.php', $data); $this->assertArrayHasKey('authId', $result); }
/** * Test #13. SYNCH request write new object. */ public function testSynchPut() { global $testTripId1, $testUserId1; global $synchAuthToken; $this->assertEquals(0, $this->countTestRows()); $data = array('tripId' => $testTripId1, 'userId' => $testUserId1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'role' => 'maintainer', 'message' => 'Message TripUser 1', 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchTripUser.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new TripUser($testTripId1, $testUserId1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals('maintainer', $object->getRole()); $this->assertEquals('Message TripUser 1', $object->getMessage()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }
/** * Test #13. SYNCH request write new object. */ public function testSynchPut() { global $testTripId1, $testMediaId1; global $synchAuthToken; $this->assertEquals(0, $this->countTestRows()); $data = array('tripId' => $testTripId1, 'mediaId' => $testMediaId1, 'created' => '2015-10-01', 'updated' => '2015-10-02', 'type' => 'photo', 'caption' => 'Caption Media 1', 'timestamp' => '2015-09-30 12:03:45', 'location' => 'location', 'width' => '900', 'height' => '600', 'deleted' => 'Y', 'hash' => 'forced hash'); $result = putApi('synchMedia.php', $data, $synchAuthToken); $this->assertEquals(RESPONSE_SUCCESS, $result['resultCode']); $this->assertEquals(1, $this->countTestRows()); $object = new Media($testTripId1, $testMediaId1); $this->assertEquals('2015-10-01 00:00:00.000000', $object->getCreated()); $this->assertEquals('2015-10-02 00:00:00.000000', $object->getUpdated()); $this->assertEquals('photo', $object->getType()); $this->assertEquals('Caption Media 1', $object->getCaption()); $this->assertEquals('2015-09-30 12:03:45', $object->getTimestamp()); $this->assertEquals('location', $object->getLocation()); $this->assertEquals('900', $object->getWidth()); $this->assertEquals('600', $object->getHeight()); $this->assertEquals("Y", $object->getDeleted()); $this->assertEquals('forced hash', $object->getHash()); }