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 7f36623 commit 72b36fd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/Console/Command/ListFilesCommand.php
Expand Up @@ -20,6 +20,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Finder\SplFileInfo;

/**
* @author Markus Staab <markus.staab@redaxo.org>
Expand Down Expand Up @@ -79,10 +80,10 @@ protected function execute(InputInterface $input, OutputInterface $output)

$finder = $resolver->getFinder();

/** @var \SplFileInfo $file */
/** @var SplFileInfo $file */
foreach ($finder as $file) {
if ($file->isFile()) {
$output->writeln(escapeshellarg($file->getPath().DIRECTORY_SEPARATOR.$file->getFilename()));
$output->writeln(escapeshellarg($file->getRelativePathname()));
}
}

Expand Down
16 changes: 7 additions & 9 deletions tests/Console/Command/ListFilesCommandTest.php
Expand Up @@ -25,28 +25,26 @@
*/
final class ListFilesCommandTest extends TestCase
{
public function testEmptyRulesValue()
public function testListWithConfig()
{
$commandTester = $this->doTestExecute();
// TODO adjust expectation
$this->assertSame('', $commandTester->getDisplay());
$commandTester = $this->doTestExecute([
'--config' => __DIR__.'/test-project/.php_cs'
]);
$this->assertSame('"needs-fixing.php"', $commandTester->getDisplay());
}

/**
* @return CommandTester
*/
private function doTestExecute(/*array $arguments*/)
private function doTestExecute(array $arguments)
{
$application = new Application();
$application->add(new ListFilesCommand(new ToolInfo()));

$command = $application->find('list-files');
$commandTester = new CommandTester($command);

$commandTester->execute([
'--config' => __DIR__.'/test-project/.php_cs'
]
);
$commandTester->execute($arguments);

return $commandTester;
}
Expand Down

0 comments on commit 72b36fd

Please sign in to comment.