{ $this->addIndex('child1', $this->one); $this->addIndex('child2', $this->two); $this->getServiceRegistry()->register($this->service); } } $one = new TestChildOne(); $two = new TestChildTwo(); $two->setServiceRegistry(new xfServiceRegistry()); $two->describe(); // forces ->setup() $dispatcher = new sfEventDispatcher(); $logger = new xfLoggerEventDispatcher($dispatcher); $service = new xfService(new xfMockIdentifier()); $group = new TestGroup(); $group->setLogger($logger); $group->one = $one; $group->two = $two; $group->service = $service; $t = new lime_test(11, new lime_output_color()); $t->ok($group->getIndex('child1') === $one, '->getIndex() returns the index'); try { $msg = '->getIndex() fails if index does not exist'; $group->getIndex('foobar'); $t->fail($msg); } catch (Exception $e) { $t->pass($msg); } $t->ok($one->getLogger() === $logger, '->setup() configures the logger of the child'); $t->ok($one->getServiceRegistry() === $group->getServiceRegistry(), '->search() passes on the service registry'); $t->ok($two->getServiceRegistry() !== $group->getServiceRegistry(), '->setup() does not override a service registry');