/** * Test that we can extract the values from the supplied Current instance * * @covers \OpenWeatherMap\Hydrator\Strategy\CurrentStrategy::extract */ public function testExtract() { $name = 'Los Angeles,US'; $city = new City(); $city->setName($name); $current = new Current(); $current->setCity($city); $strategy = new CurrentStrategy(); $values = $strategy->extract($current); $this->assertArrayHasKey('city', $values); $this->assertEquals($name, $values['city']['name']); }
/** * Test that attempting to set the name to a non string value * results in an exception being thrown * * @expectedException \InvalidArgumentException * @covers \OpenWeatherMap\Entity\City::setName */ public function testSetNameThrowsException() { $city = new City(); $city->setName(new stdClass()); }