コード例 #1
0
 /**
  * Test that we can extract the values from an instance of Precipitation
  *
  * @covers \OpenWeatherMap\Hydrator\Strategy\PrecipitationStrategy::extract
  */
 public function testExtract()
 {
     $value = 1;
     $type = 'snow';
     $precipitation = new Precipitation();
     $precipitation->setValue($value)->setType($type);
     $strategy = new PrecipitationStrategy();
     $values = $strategy->extract($precipitation);
     $this->assertArrayHasKey('value', $values);
     $this->assertArrayHasKey('type', $values);
 }
コード例 #2
0
 /**
  * Test that attempting to set the type with an invalid value
  * results in a exception being thrown
  *
  * @expectedException InvalidArgumentException
  * @covers \OpenWeatherMap\Entity\Precipitation::setType
  */
 public function testSetTypeThrowsException()
 {
     $precipitation = new Precipitation();
     $type = new stdClass();
     $precipitation->setType($type);
 }