示例#1
0
 public function tearDown()
 {
     Helper::tearDown();
     ParseUser::logOut();
     Helper::clearClass(ParseUser::$parseClassName);
     Helper::clearClass(ParseSession::$parseClassName);
 }
示例#2
0
 public function tearDown()
 {
     Helper::tearDown();
 }
示例#3
0
 public function tearDown()
 {
     Helper::clearClass('BytesObject');
     Helper::tearDown();
 }
示例#4
0
 public function testUserLoadedFromStorageFromLogIn()
 {
     Helper::clearClass(ParseUser::$parseClassName);
     $fosco = new ParseUser();
     $fosco->setUsername('fosco');
     $fosco->setPassword('password');
     $fosco->signUp();
     $id = $fosco->getObjectId();
     $this->assertNotNull($id);
     ParseUser::logOut();
     ParseUser::_clearCurrentUserVariable();
     $current = ParseUser::getCurrentUser();
     $this->assertNull($current);
     ParseUser::logIn("fosco", "password");
     $current = ParseUser::getCurrentUser();
     $this->assertEquals($id, $current->getObjectId());
     ParseUser::_clearCurrentUserVariable();
     $current = ParseUser::getCurrentUser();
     $this->assertEquals($id, $current->getObjectId());
 }
示例#5
0
 public function provideTimeTestObjects()
 {
     Helper::clearClass("TimeObject");
     $items = [];
     $this->saveObjects(3, function ($i) use(&$items) {
         $timeObject = ParseObject::create('TimeObject');
         $timeObject->set('name', 'item' . $i);
         $timeObject->set('time', new \DateTime());
         sleep(1);
         $items[] = $timeObject;
         return $timeObject;
     });
     return $items;
 }
 public function tearDown()
 {
     Helper::tearDown();
     self::$parseStorage->clear();
 }
示例#7
0
 public function tearDown()
 {
     Helper::clearClass("TestObject");
     Helper::tearDown();
 }
示例#8
0
 public function testSaveAll()
 {
     Helper::clearClass('TestObject');
     $objs = [];
     for ($i = 1; $i <= 90; $i++) {
         $obj = ParseObject::create('TestObject');
         $obj->set('test', 'test');
         $objs[] = $obj;
     }
     ParseObject::saveAll($objs);
     $query = new ParseQuery('TestObject');
     $result = $query->find();
     $this->assertEquals(90, count($result));
 }
示例#9
0
 public function tearDown()
 {
     $createClass = new ParseSchema('Game');
     $createClass->delete();
     Helper::tearDown();
 }
示例#10
0
 public static function setUpBeforeClass()
 {
     Helper::setUp();
 }
示例#11
0
 public function testIncludedObjectsGetACLWithDefaultACL()
 {
     Helper::clearClass("Test");
     Helper::clearClass("Related");
     $defaultACL = new ParseACL();
     $defaultACL->setPublicReadAccess(true);
     $defaultACL->setPublicWriteAccess(true);
     ParseACL::setDefaultACL($defaultACL, true);
     $object = ParseObject::create('Test');
     $acl = new ParseACL();
     $acl->setPublicReadAccess(true);
     $object->setACL($acl);
     $object->save();
     $this->assertTrue($object->getACL()->getPublicReadAccess());
     $related = ParseObject::create('Related');
     $related->set('test', $object);
     $related->save();
     $query = new ParseQuery('Related');
     $query->includeKey('test');
     $objectAgain = $query->first()->get('test');
     $this->assertTrue($objectAgain->getACL()->getPublicReadAccess());
     $this->assertFalse($objectAgain->getACL()->getPublicWriteAccess());
 }
示例#12
0
 public function tearDown()
 {
     Helper::tearDown();
     self::$schema->delete();
 }
示例#13
0
 public function testGeoMaxDistanceWithUnits()
 {
     Helper::clearClass("PlaceObject");
     // [SAC] 38.52 -121.50 Sacramento,CA
     $sacramento = new ParseGeoPoint(38.52, -121.5);
     $obj = ParseObject::create('PlaceObject');
     $obj->set('location', $sacramento);
     $obj->set('name', 'Sacramento');
     $obj->save();
     // [HNL] 21.35 -157.93 Honolulu Int,HI
     $honolulu = new ParseGeoPoint(21.35, -157.93);
     $obj = ParseObject::create('PlaceObject');
     $obj->set('location', $honolulu);
     $obj->set('name', 'Honolulu');
     $obj->save();
     // [51Q] 37.75 -122.68 San Francisco,CA
     $sanfran = new ParseGeoPoint(37.75, -122.68);
     $obj = ParseObject::create('PlaceObject');
     $obj->set('location', $sanfran);
     $obj->set('name', 'San Francisco');
     $obj->save();
     // test point SFO
     $point = new ParseGeoPoint(37.6189722, -122.3748889);
     // Kilometers
     // baseline all
     $query = new ParseQuery('PlaceObject');
     $query->near('location', $point);
     $results = $query->find();
     $this->assertEquals(3, count($results));
     // max with all
     $query = new ParseQuery('PlaceObject');
     $query->withinKilometers('location', $point, 4000.0);
     $results = $query->find();
     $this->assertEquals(3, count($results));
     // drop hawaii
     $query = new ParseQuery('PlaceObject');
     $query->withinKilometers('location', $point, 3700.0);
     $results = $query->find();
     $this->assertEquals(2, count($results));
     // drop sacramento
     $query = new ParseQuery('PlaceObject');
     $query->withinKilometers('location', $point, 100.0);
     $results = $query->find();
     $this->assertEquals(1, count($results));
     $this->assertEquals('San Francisco', $results[0]->get('name'));
     // drop SF
     $query = new ParseQuery('PlaceObject');
     $query->withinKilometers('location', $point, 10.0);
     $results = $query->find();
     $this->assertEquals(0, count($results));
     // Miles
     // max with all
     $query = new ParseQuery('PlaceObject');
     $query->withinMiles('location', $point, 2500.0);
     $results = $query->find();
     $this->assertEquals(3, count($results));
     // drop hawaii
     $query = new ParseQuery('PlaceObject');
     $query->withinMiles('location', $point, 2200.0);
     $results = $query->find();
     $this->assertEquals(2, count($results));
     // drop sacramento
     $query = new ParseQuery('PlaceObject');
     $query->withinMiles('location', $point, 75.0);
     $results = $query->find();
     $this->assertEquals(1, count($results));
     $this->assertEquals('San Francisco', $results[0]->get('name'));
     // drop SF
     $query = new ParseQuery('PlaceObject');
     $query->withinMiles('location', $point, 10.0);
     $results = $query->find();
     $this->assertEquals(0, count($results));
 }
示例#14
0
 public function tearDown()
 {
     Helper::tearDown();
     Helper::clearClass('TestFileObject');
 }