phpro / grumphp

A PHP code-quality tool
MIT License
4.13k stars 430 forks source link

Fix #887 - Paratest: parallel- and configuration-argument was passed incorrectly #915

Closed Zombaya closed 3 years ago

Zombaya commented 3 years ago
Q A
Branch master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Documented? no
Fixed tickets #887

Solves incorrectly passed arguments to paratest.

janvernieuwe commented 3 years ago

Very strange, the --help allows for the shorter arguments. This is my output, what it yours?

vendor/bin/paratest --help
Usage:
  paratest [options] [--] [<path>]

Arguments:
  path                                           The path to a directory or file containing tests.

Options:
      --bootstrap=BOOTSTRAP                      The bootstrap file to be used by PHPUnit.
      --colors                                   Displays a colored bar as a test result.
  -c, --configuration=CONFIGURATION              The PHPUnit configuration file to use.
      --coverage-clover=COVERAGE-CLOVER          Generate code coverage report in Clover XML format.
      --coverage-cobertura=COVERAGE-COBERTURA    Generate code coverage report in Cobertura XML format.
      --coverage-crap4j=COVERAGE-CRAP4J          Generate code coverage report in Crap4J XML format.
      --coverage-html=COVERAGE-HTML              Generate code coverage report in HTML format.
      --coverage-php=COVERAGE-PHP                Serialize PHP_CodeCoverage object to file.
      --coverage-test-limit=COVERAGE-TEST-LIMIT  Limit the number of tests to record for each line of code. Helps to reduce memory and size of coverage reports.
      --coverage-text                            Generate code coverage report in text format.
      --coverage-xml=COVERAGE-XML                Generate code coverage report in PHPUnit XML format.
      --exclude-group=EXCLUDE-GROUP              Don't run tests from the specified group(s).
      --filter=FILTER                            Filter (only for functional mode).
  -f, --functional                               Run test methods instead of classes in separate processes.
  -g, --group=GROUP                              Only runs tests from the specified group(s).
  -h, --help                                     Display this help message.
      --log-junit=LOG-JUNIT                      Log test execution in JUnit XML format to file.
      --log-teamcity=LOG-TEAMCITY                Log test execution in Teamcity format to file.
  -m, --max-batch-size=MAX-BATCH-SIZE            Max batch size (only for functional mode). [default: 0]
      --no-test-tokens                           Disable TEST_TOKEN environment variables. (default: variable is set)
      --order-by[=ORDER-BY]                      Run tests in order: default|random|reverse
      --parallel-suite                           Run the suites of the config in parallel.
      --passthru=PASSTHRU                        Pass the given arguments verbatim to the underlying test framework. Example: --passthru="'--prepend' 'xdebug-filter.php'"
      --passthru-php=PASSTHRU-PHP                Pass the given arguments verbatim to the underlying php process. Example: --passthru-php="'-d' 'zend_extension=xdebug.so'"
      --path=PATH                                An alias for the path argument.
  -p, --processes=PROCESSES                      The number of test processes to run. [default: "auto"]
      --random-order-seed[=RANDOM-ORDER-SEED]    Use a specific random seed <N> for random order
      --runner=RUNNER                            Runner or WrapperRunner. [default: "Runner"]
      --stop-on-failure                          Don't start any more processes after a failure.
      --testsuite=TESTSUITE                      Filter which testsuite to run
      --tmp-dir=TMP-DIR                          Temporary directory for internal ParaTest files [default: "/tmp"]
  -v, --verbose=VERBOSE                          If given, debug output is printed. Example: --verbose=1 [default: 0]
      --whitelist=WHITELIST                      Directory to add to the coverage whitelist.

I am using brianium/paratest v6.0.0 Parallel testing for PHP

Zombaya commented 3 years ago

As mentioned in #887, It allows the shorter arguments, but then you are supposed to use a space as separator or no seperator. This holds true for all commands based on Symfony\Component\Console\Command\Command

So either we had to pass -p PROCESSES,-pPROCESSES or --processes=PROCESSES.
For example: if we wanted 4 processes, this would be -p 4, -p4 or --processes=4.

I chose the longer format as it shows more information.

veewee commented 3 years ago

Looks good, thanks for the work!