/** * Test that we can extract values from a City instance * * @covers \OpenWeatherMap\Hydrator\Strategy\CityStrategy::extract */ public function testExtract() { $cityStrategy = new CityStrategy(); $city = new City(); $city->setId(123)->setName('Los Angeles'); $values = $cityStrategy->extract($city); $this->assertArrayHasKey('id', $values); $this->assertArrayHasKey('name', $values); }
/** * Test that attempting to set the id value with a non digit * value throws an exception * * @expectedException InvalidArgumentException * @covers \OpenWeatherMap\Entity\City::setId */ public function testSetIdThrowsException() { $city = new City(); $city->setId(new stdClass()); }