public function testSetServicePropagatesToChildren() { // Setup $entries = array(new App\Entry(), new App\Entry()); foreach ($entries as $entry) { $this->feed->addEntry($entry); } // Set new service instance and test for propagation $s = new App(); $this->feed->setService($s); $service = $this->feed->getService(); if (!is_object($service)) { $this->fail('No feed service received'); } $this->assertEquals('Zend\\GData\\App', get_class($service)); foreach ($entries as $entry) { $service = $entry->getService(); if (!is_object($service)) { $this->fail('No entry service received'); } $this->assertEquals('Zend\\GData\\App', get_class($service)); } // Set null service instance and test for propagation $s = null; $this->feed->setService($s); $this->assertFalse(is_object($this->feed->getService())); foreach ($entries as $entry) { $service = $entry->getService(); $this->assertFalse(is_object($service)); } }