예제 #1
0
 public function testAddExtensionListener()
 {
     $plugin = new Extension();
     $plugin->addListener('unit', new SimpleEventListener());
     $this->assertCount(1, $plugin->getListeners('unit'));
     $this->assertInstanceOf(SimpleEventListener::class, $plugin->getListeners('unit')[0]);
 }
 /**
  * @param   Extension $extension    The extension
  * @param   array     $contentTypes Content type configurations
  *
  * @return  void
  */
 private function createContentTypes(Extension $extension, array $contentTypes)
 {
     foreach ($contentTypes as $name => $contentType) {
         $extension->addContentType($name, $contentType['class']);
     }
 }
 /**
  * @param   Extension $extension      The extension
  * @param   array     $handlersConfig Handler configuration
  *
  * @return  void
  */
 private function createQueryHandlers(Extension $extension, array $handlersConfig)
 {
     foreach ($handlersConfig as $handler) {
         $extension->addQueryHandler($handler['query'], new $handler['class']($this->container->get('CommandBus'), $this->container->get('EventDispatcher')));
     }
 }