public function testInsertPlacePointCoordsOnly() { $place = array('point_coords' => array('type' => 'Point', 'coordinates' => array(-97.723366, 30.296095))); $this->dao->insertPlace($place, 123456, 'twitter'); $res = $this->dao->getPostPlace(123456); $this->assertEqual(sizeof($res), 5); $this->assertEqual($res['post_id'], 123456); $this->assertEqual($res['place_id'], null); $this->assertEqual($res['longlat'], 'POINT(-97.723366 30.296095)'); }
/** * Same as above, but no point coord info */ public function testAddPostAndAssociatedInfoPlaceBBOnly() { list($post, $entities, $user_array) = $this->buildStreamPostArray2(); // remove the point coord info-- post data now has just bounding box info unset($entities['place']['point_coords']); $dao = new PostMySQLDAO(); $dao->addPostAndAssociatedInfo($post, $entities, $user_array); $post = $dao->getPost('39451255650648064', 'twitter'); $this->assertEqual($post->place_id, '1a16a1d70500c27d'); $p_dao = new PlaceMySQLDAO(); $pinfo = $p_dao->getPlaceByID('1a16a1d70500c27d'); $this->assertEqual($pinfo['bounding_box'], 'POLYGON((-97.73818308 30.29930703,-97.710741 30.29930703,-97.710741 30.31480602,-97.73818308 ' . '30.31480602,-97.73818308 30.29930703))'); // $this->assertEqual($pinfo['longlat'], 'POINT(-97.72446204 30.307056525)'); // due to rounding diffs, do 'contains' tests rather than string equality. // The result should be approx that of above $this->assertPattern('/POINT\\(-97.72446/', $pinfo['longlat']); $this->assertPattern('/ 30.3070565/', $pinfo['longlat']); $this->assertEqual($pinfo['place_id'], '1a16a1d70500c27d'); $ploc = $p_dao->getPostPlace('39451255650648064'); $this->assertEqual($ploc, null); }