/** * Test that we can extract the values from an instance of Temperature * * @covers \OpenWeatherMap\Hydrator\Strategy\TemperatureStrategy::extract */ public function testExtract() { $day = 263.09; $min = 262.93; $max = 263.88; $night = 263.88; $evening = 263.09; $morning = 263.09; $temperature = new Temperature(); $temperature->setDay($day)->setMin($min)->setMax($max)->setNight($night)->setEvening($evening)->setMorning($morning); $strategy = new TemperatureStrategy(); $values = $strategy->extract($temperature); $this->assertArrayHasKey('day', $values); $this->assertArrayHasKey('min', $values); $this->assertArrayHasKey('max', $values); $this->assertArrayHasKey('night', $values); $this->assertArrayHasKey('evening', $values); $this->assertArrayHasKey('morning', $values); }
/** * Test that attempting to set the unit value with a non string results * in an exception being thrown * * @expectedException InvalidArgumentException * @covers \OpenWeatherMap\Entity\Temperature::setUnit */ public function testSetUnitWithNonStringThrowsException() { $temperature = new Temperature(); $temperature->setUnit(new \stdClass()); }