public function testContainerSetting() { $that = $this; EventDispatcherProxy::setDispatcherGetter(function () use($that) { $c = $that->getContainer(); $d = new ContainerAwareEventDispatcher($c); $d->addListener('model.construct', array(new ContainerAwareModel($c), 'onModelConstruct')); return $d; }); $b = new Book(); $this->assertTrue($b->hasContainer(), 'Container is set on object creation'); }