Exemplo n.º 1
0
 public function testCorrection()
 {
     $Route = new Route\Object(array(Route\Object::LATITUDES => array(49.44, 49.441, 49.442, 49.443, 49.444, 49.445, 49.446, 49.447, 49.448, 49.449, 49.45), Route\Object::LONGITUDES => array(7.76, 7.761, 7.762, 7.763, 7.764, 7.765, 7.766, 7.767, 7.768, 7.769, 7.77)));
     $Calc = new Calculator($Route);
     if ($Calc->tryToCorrectElevation()) {
         $this->assertEmpty($Route->elevationsOriginal());
         $this->assertNotEmpty($Route->elevationsCorrected());
         $this->assertNotEmpty($Route->get(Route\Object::ELEVATIONS_SOURCE));
     } else {
         $this->markTestSkipped('No elevation correction was not available.');
     }
 }
Exemplo n.º 2
0
 public function testSimpleInsert()
 {
     $R = new Object(array(Object::NAME => 'Test route', Object::DISTANCE => 3.14, Object::LATITUDES => array(47.7, 47.8), Object::LONGITUDES => array(7.8, 7.7)));
     $I = new Inserter($this->PDO, $R);
     $I->setAccountID(0);
     $I->insert();
     $data = $this->PDO->query('SELECT * FROM `' . PREFIX . 'route` WHERE `accountid`=0')->fetch(PDO::FETCH_ASSOC);
     $N = new Object($data);
     $this->assertEquals(0, $data[Inserter::ACCOUNTID]);
     $this->assertEquals('Test route', $N->name());
     $this->assertTrue($N->hasID());
     $this->assertTrue($N->hasPositionData());
     $this->assertEquals(47.7, $N->get(Object::MIN_LATITUDE));
 }