Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
clxmstaab committed Apr 15, 2021
1 parent ac8773d commit 06beee5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
15 changes: 5 additions & 10 deletions src/Console/Command/ListFilesCommand.php
Expand Up @@ -20,7 +20,6 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\SplFileInfo as sfSplFileInfo;
use SplFileInfo;

/**
Expand Down Expand Up @@ -68,6 +67,7 @@ protected function configure()
protected function execute(InputInterface $input, OutputInterface $output)
{
$passedConfig = $input->getOption('config');
$cwd = getcwd();

$resolver = new ConfigurationResolver(
$this->defaultConfig,
Expand All @@ -80,16 +80,11 @@ protected function execute(InputInterface $input, OutputInterface $output)

$finder = $resolver->getFinder();

/** @var SplFileInfo|sfSplFileInfo $file */
/** @var SplFileInfo $file */
foreach ($finder as $file) {
if ($file instanceof sfSplFileInfo) {
if ($file->isFile()) {
$output->writeln(escapeshellarg($file->getRelativePathname()));
}
} else if ($file instanceof SplFileInfo) {
if ($file->isFile()) {
$output->writeln(escapeshellarg($file->getPathname()));
}
if ($file->isFile()) {
$relativePath = str_replace($cwd, '.', $file->getPathname());
$output->writeln(escapeshellarg($relativePath));
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/Console/Command/ListFilesCommandTest.php
Expand Up @@ -30,7 +30,7 @@ public function testListWithConfig()
$commandTester = $this->doTestExecute([
'--config' => __DIR__ . '/../../Fixtures/ListFilesTest/.php-cs-fixer.php'
]);
$this->assertSame(escapeshellarg('needs-fixing/needs-fixing.php').PHP_EOL, $commandTester->getDisplay());
$this->assertSame(escapeshellarg('./tests/Fixtures/ListFilesTest/needs-fixing/needs-fixing.php').PHP_EOL, $commandTester->getDisplay());
}

/**
Expand Down

0 comments on commit 06beee5

Please sign in to comment.