/** * @param callable|ApplicationConfig $config * * @return ConsoleApplication */ protected function createApplication($config) { $commandBus = CommandBus::create(); $eventBus = DomainEventPublisher::eventBus(); $migrationsService = new MigrationsService(new Migrator($this->getClassMetadataFactory(), new InMemoryMigrationStore(), new InMemoryEventStore(), $this->migrationsDirectory)); $commandBus->addHandler(MigrationsGenerateCommand::class, $migrationsService); $commandBus->addHandler(MigrationsMigrateCommand::class, $migrationsService); $commandBus->addHandler(MigrationsStatusCommand::class, $migrationsService); return new ConsoleApplication($config, $commandBus, $eventBus); }
/** * Test eventBus method. */ public function testEventBus() { $this->given($eventBus = EventBus::create())->when(DomainEventPublisher::set($eventBus))->then()->object(DomainEventPublisher::eventBus())->isEqualTo($eventBus); }