Unset SHELL_VERBOSITY environment variable before execution of command by Naktibalda · Pull Request #13 · Codeception/module-cli
While testing Codeception, I noticed that some cli tests fail when Codeception is executed with -v flag.
Codeception$ ./codecept run cli RunSkippedCept
Codeception PHP Testing Framework v5.0.6 https://helpukrainewin.org
Cli Tests (1) -----------------------------------------------------------------------------------------------------------------------
✔ RunSkippedCept: Run skipped test (0.09s)
-------------------------------------------------------------------------------------------------------------------------------------
Time: 00:00.283, Memory: 8.00 MB
OK (1 test, 3 assertions)
Codeception$ ./codecept run cli RunSkippedCept -v
Codeception PHP Testing Framework v5.0.6 https://helpukrainewin.org
Cli Tests (1) -----------------------------------------------------------------------------------------------------------------------
Modules: Filesystem, Cli, CliHelper, CodeHelper, Asserts
-------------------------------------------------------------------------------------------------------------------------------------
✖ RunSkippedCept: Run skipped test (0.09s)
-------------------------------------------------------------------------------------------------------------------------------------
Time: 00:00.286, Memory: 8.00 MB
There was 1 failure:
1) RunSkippedCept: Run skipped test
Test tests/cli/RunSkippedCept.php
Step See in shell output "run with `-v` to get more info"
Fail Failed asserting that 'Codeception PHP Testing Framework v5.0.6 https://helpukrainewin.org\n
\n
Skipped Tests (1) -------------------------------------------------------------------------------------------------------------------\n
Modules: SkipHelper\n
-------------------------------------------------------------------------------------------------------------------------------------\n
S SkipMeCept: Skip it\n
-------------------------------------------------------------------------------------------------------------------------------------\n
Time: 00:00.019, Memory: 6.00 MB\n
\n
There was 1 skipped test:\n
1) SkipMeCept: Skip it\n
Test tests/skipped/SkipMeCept.php\n
OK, but incomplete, skipped, or useless tests!\n
Tests: 1, Assertions: 0, Skipped: 1.' contains "run with `-v` to get more info".
Scenario Steps:
5. $I->seeInShellOutput("run with `-v` to get more info") at tests/cli/RunSkippedCept.php:9
4. $I->seeInShellOutput("OK, but incomplete, skipped, or useless tests!") at tests/cli/RunSkippedCept.php:8
3. $I->seeInShellOutput("S SkipMeCept: Skip it") at tests/cli/RunSkippedCept.php:7
2. $I->executeCommand("run skipped SkipMeCept.php") at tests/cli/RunSkippedCept.php:6
1. $I->amInPath("tests/data/sandbox") at tests/cli/RunSkippedCept.php:5
\Symfony\Component\Console\Tester\ApplicationTester unsets SHELL_VERBOSITY too, so it seems like a good approach to unset it in Cli::runShellCommand.