public function testNoMessagesLoadedEvent() { $actualEvent = null; $this->translator->enableEventManager(); $this->translator->getEventManager()->attach(Translator::EVENT_NO_MESSAGES_LOADED, function (EventInterface $event) use(&$actualEvent) { $actualEvent = $event; }); $this->translator->translate('foo', 'bar', 'baz'); $this->assertInstanceOf('Zend\\EventManager\\Event', $actualEvent); $this->assertEquals(array('locale' => 'baz', 'text_domain' => 'bar'), $actualEvent->getParams()); // But fire no event when disabled $actualEvent = null; $this->translator->disableEventManager(); $this->translator->translate('foo', 'bar', 'baz'); $this->assertNull($actualEvent); }