Skip to content

Commit

Permalink
[BUGFIX] Fix verbosity in functional tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a-r-m-i-n committed Dec 28, 2023
1 parent d038721 commit 53927aa
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
8 changes: 4 additions & 4 deletions tests/Functional/EditorConfig/CommandFinderConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function testValidCase()
$command = new Application();
$command->setAutoExit(false);
$commandTester = new CommandTester($command);
$commandTester->execute(['-d' => $this->workspacePath, '-v' => true, '--finder-config' => 'finder-config.php', '--no-progress' => true]);
$commandTester->execute(['-d' => $this->workspacePath, '--finder-config' => 'finder-config.php', '--no-progress' => true]);

self::assertSame(2, $commandTester->getStatusCode(), $commandTester->getDisplay());
self::assertStringContainsString('Searching with custom Finder instance', $commandTester->getDisplay());
Expand All @@ -68,7 +68,7 @@ public function testMissingConfigFile()
$command->setAutoExit(false);
$commandTester = new CommandTester($command);

$commandTester->execute(['-d' => $this->workspacePath, '-v' => true, '--finder-config' => 'not-existing.php', '--no-progress' => true]);
$commandTester->execute(['-d' => $this->workspacePath, '--finder-config' => 'not-existing.php', '--no-progress' => true]);

self::assertSame(1621342890, $commandTester->getStatusCode(), $commandTester->getDisplay());
self::assertStringContainsString('Finder config file', $commandTester->getDisplay());
Expand All @@ -81,14 +81,14 @@ public function testInvalidConfigFile()
$command->setAutoExit(false);
$commandTester = new CommandTester($command);

$commandTester->execute(['-d' => $this->workspacePath, '-v' => true, '--finder-config' => 'finder-config-invalid.php', '--no-progress' => true]);
$commandTester->execute(['-d' => $this->workspacePath, '--finder-config' => 'finder-config-invalid.php', '--no-progress' => true]);

self::assertSame(1621343069, $commandTester->getStatusCode(), $commandTester->getDisplay());
self::assertStringContainsString('Custom Symfony Finder configuration', $commandTester->getDisplay());
self::assertStringContainsString('should return an instance of', $commandTester->getDisplay());
self::assertStringContainsString('Instead it returns: string', $commandTester->getDisplay());

$commandTester->execute(['-d' => $this->workspacePath, '-v' => true, '--finder-config' => 'finder-config-invalid2.php', '--no-progress' => true]);
$commandTester->execute(['-d' => $this->workspacePath, '--finder-config' => 'finder-config-invalid2.php', '--no-progress' => true]);
self::assertStringContainsString('Instead it returns: instance of stdClass', $commandTester->getDisplay());
}
}
3 changes: 2 additions & 1 deletion tests/Functional/EditorConfig/CommandNoErrorOnExitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Armin\EditorconfigCli\Tests\Functional\EditorConfig;

use Armin\EditorconfigCli\Application;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;

class CommandNoErrorOnExitTest extends AbstractTestCase
Expand All @@ -25,7 +26,7 @@ public function testNoErrorOnExit()
$command = new Application();
$command->setAutoExit(false);
$commandTester = new CommandTester($command);
$commandTester->execute(['-d' => $this->workspacePath, '-v' => true, '--no-error-on-exit' => true]);
$commandTester->execute(['-d' => $this->workspacePath, '--no-error-on-exit' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE]);

self::assertSame(0, $commandTester->getStatusCode());
self::assertStringContainsString('Bypassing error code 2', $commandTester->getDisplay());
Expand Down
3 changes: 2 additions & 1 deletion tests/Functional/EditorConfig/CommandSkipBinaryFilesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace Armin\EditorconfigCli\Tests\Functional\EditorConfig;

use Armin\EditorconfigCli\Application;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Tester\CommandTester;

class CommandSkipBinaryFilesTest extends AbstractTestCase
Expand Down Expand Up @@ -35,7 +36,7 @@ public function testSkipBinaryFiles()
$command = new Application();
$command->setAutoExit(false);
$commandTester = new CommandTester($command);
$commandTester->execute(['-d' => $this->workspacePath, '-v' => true, '--no-progress' => true]);
$commandTester->execute(['-d' => $this->workspacePath, '--no-progress' => true], ['verbosity' => OutputInterface::VERBOSITY_VERBOSE]);

self::assertSame(0, $commandTester->getStatusCode());
self::assertStringContainsString('Done. No issues found.', $commandTester->getDisplay());
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/EditorConfig/CommandValidCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ public function testValidCase()

self::assertSame(0, $commandTester->getStatusCode(), $commandTester->getDisplay());
self::assertStringContainsString('Done. No issues found.', $commandTester->getDisplay());
self::assertStringContainsString('Duration: ', $commandTester->getDisplay());
}
}

0 comments on commit 53927aa

Please sign in to comment.