コード例 #1
0
 /**
  * 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']);
 }
コード例 #2
0
 /**
  * Test that attempting to set the lastupdate value using a non string
  * value results in an exception
  *
  * @expectedException InvalidArgumentException
  * @covers \OpenWeatherMap\Entity\Current::setLastUpdate
  */
 public function testSetLastUpdateThrowsException()
 {
     $current = new Current();
     $current->setLastUpdate(new stdClass());
 }