/** * @covers Component\Remote\BurzeDzisNet\WeatherAlert::hasAlert */ public function testHasAlert() { $alert = new WeatherAlert(); $this->assertFalse($alert->hasAlert('storm')); $alert2 = $alert->withAlert('storm', new Alert(1, '2015-02-12', '2015-02-13')); $this->assertTrue($alert2->hasAlert('storm')); $alert3 = $alert2->withAlert('wind', new Alert(2, '2015-02-12', '2015-02-13')); $this->assertTrue($alert3->hasAlert('wind')); $this->assertTrue($alert3->hasAlert('storm')); }
/** * WeatherAlert * * @param WeatherAlert|null $alert set of alerts */ public function __construct(WeatherAlert $alert = null) { $this->alerts = $alert != null ? $alert->toArray() : []; }