示例#1
0
 /**
  * Test that we can get and set the longitude
  *
  * @covers \OpenWeatherMap\Entity\Coord::getLongitude
  * @covers \OpenWeatherMap\Entity\Coord::setLongitude
  */
 public function testGetSetLongitude()
 {
     $coord = new Coord();
     $longitude = 145.77;
     $this->assertNull($coord->getLongitude());
     $this->assertSame($coord, $coord->setLongitude($longitude));
     $this->assertEquals($longitude, $coord->getLongitude());
 }
 /**
  * Test that we can extract the values from an instance of Coord
  *
  * @covers \OpenWeatherMap\Hydrator\Strategy\CoordStrategy::extract
  */
 public function testExtract()
 {
     $latitude = -16.92;
     $longitude = 145.77;
     $coord = new Coord();
     $coord->setLatitude($latitude)->setLongitude($longitude);
     $strategy = new CoordStrategy();
     $values = $strategy->extract($coord);
     $this->assertArrayHasKey('latitude', $values);
     $this->assertArrayHasKey('longitude', $values);
 }