1<?php 2 3namespace Elgg\Cli; 4 5use Elgg\IntegrationTestCase; 6use Symfony\Component\Console\Application; 7use Symfony\Component\Console\Tester\CommandTester; 8 9/** 10 * @group Cli 11 */ 12class UpgradeBatchCommandTest extends IntegrationTestCase { 13 14 public function up() { 15 self::createApplication([ 16 'isolate'=> true, 17 ]); 18 } 19 20 public function down() { 21 22 } 23 24 public function testExecuteWithoutOptions() { 25 $application = new Application(); 26 $application->add(new UpgradeBatchCommand()); 27 28 $command = $application->find('upgrade:batch'); 29 $commandTester = new CommandTester($command); 30 $commandTester->execute([ 31 'command' => $command->getName(), 32 'upgrades' => ['RandomNonExistingClass'], 33 ]); 34 35 $this->assertStringContainsString(elgg_echo('cli:upgrade:batch:finished'), $commandTester->getDisplay()); 36 } 37 38 public function testExecuteWithQuietOutput() { 39 $application = new Application(); 40 $application->add(new UpgradeBatchCommand()); 41 42 $command = $application->find('upgrade:batch'); 43 $commandTester = new CommandTester($command); 44 $commandTester->execute([ 45 'command' => $command->getName(), 46 'upgrades' => ['RandomNonExistingClass'], 47 '--quiet' => true, 48 ]); 49 50 $this->assertEmpty($commandTester->getDisplay()); 51 } 52} 53