Removed duplicated code during CLI command tests

This commit is contained in:
Alejandro Celaya
2021-04-08 13:42:56 +02:00
parent 1f8994ca8b
commit 86230d9bf3
16 changed files with 49 additions and 123 deletions

View File

@@ -6,11 +6,10 @@ namespace ShlinkioTest\Shlink\CLI\Command\Db;
use PHPUnit\Framework\TestCase;
use Prophecy\Argument;
use Prophecy\PhpUnit\ProphecyTrait;
use Prophecy\Prophecy\ObjectProphecy;
use Shlinkio\Shlink\CLI\Command\Db\MigrateDatabaseCommand;
use Shlinkio\Shlink\CLI\Util\ProcessRunnerInterface;
use Symfony\Component\Console\Application;
use ShlinkioTest\Shlink\CLI\CliTestUtilsTrait;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;
use Symfony\Component\Lock\LockFactory;
@@ -19,7 +18,7 @@ use Symfony\Component\Process\PhpExecutableFinder;
class MigrateDatabaseCommandTest extends TestCase
{
use ProphecyTrait;
use CliTestUtilsTrait;
private CommandTester $commandTester;
private ObjectProphecy $processHelper;
@@ -43,10 +42,7 @@ class MigrateDatabaseCommandTest extends TestCase
$this->processHelper->reveal(),
$phpExecutableFinder->reveal(),
);
$app = new Application();
$app->add($command);
$this->commandTester = new CommandTester($command);
$this->commandTester = $this->testerForCommand($command);
}
/** @test */