Exemplo n.º 1
0
 /**
  * @covers \OpenWeatherMap\Entity\Pressure::getUnit
  * @covers \OpenWeatherMap\Entity\Pressure::setUnit
  */
 public function testGetSetUnit()
 {
     $unit = 'hPa';
     $pressure = new Pressure();
     $this->assertNull($pressure->getUnit());
     $this->assertSame($pressure, $pressure->setUnit($unit));
     $this->assertEquals($unit, $pressure->getUnit());
 }
 /**
  * Test that we can extract the values from an instance of Pressure
  *
  * @covers \OpenWeatherMap\Hydrator\Strategy\PressureStrategy::extract
  */
 public function testExtract()
 {
     $unit = 'hPa';
     $value = 1011.45;
     $pressure = new Pressure();
     $pressure->setUnit($unit)->setValue($value);
     $strategy = new PressureStrategy();
     $values = $strategy->extract($pressure);
     $this->assertArrayHasKey('unit', $values);
     $this->assertArrayHasKey('value', $values);
 }