public function testRemoveObserver() { $weatherData = new WeatherData(); $curCondDisplay = new CurrentConditionsDisplay($weatherData); // before any update from weatherData $expected = "CurrentConditionsDisplay: 0 F degrees and 0% humidity."; $this->assertEquals($expected, $curCondDisplay->display()); // remove currentConditionsDisplay from Observers $weatherData->removeObserver($curCondDisplay); // change weatherData, so current conditions should change as well $weatherData->setMeasurements(5, 5, 5); // same message observer was not notified $this->assertEquals($expected, $curCondDisplay->display()); }