prophesize(LockFactory::class); $lock = $this->prophesize(LockInterface::class); $lock->acquire(Argument::any())->willReturn(true); $lock->release()->will(function (): void { }); $locker->createLock(Argument::cetera())->willReturn($lock->reveal()); $phpExecutableFinder = $this->prophesize(PhpExecutableFinder::class); $phpExecutableFinder->find(false)->willReturn('/usr/local/bin/php'); $this->processHelper = $this->prophesize(ProcessHelper::class); $command = new MigrateDatabaseCommand( $locker->reveal(), $this->processHelper->reveal(), $phpExecutableFinder->reveal(), ); $app = new Application(); $app->add($command); $this->commandTester = new CommandTester($command); } /** @test */ public function migrationsCommandIsRunWithProperVerbosity(): void { $runCommand = $this->processHelper->mustRun(Argument::type(OutputInterface::class), [ '/usr/local/bin/php', MigrateDatabaseCommand::DOCTRINE_MIGRATIONS_SCRIPT, MigrateDatabaseCommand::DOCTRINE_MIGRATE_COMMAND, ], Argument::cetera()); $this->commandTester->execute([]); $output = $this->commandTester->getDisplay(); $this->assertStringContainsString('Migrating database...', $output); $this->assertStringContainsString('Database properly migrated!', $output); $runCommand->shouldHaveBeenCalledOnce(); } }