Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPUnit options delimiter bug when passing options to PHPUnit #108

Open
1 task
ntwb opened this issue Oct 29, 2020 · 2 comments
Open
1 task

PHPUnit options delimiter bug when passing options to PHPUnit #108

ntwb opened this issue Oct 29, 2020 · 2 comments
Labels
bug Existing functionality isn't behaving as expected should have Should be done, medium priority for now

Comments

@ntwb
Copy link

ntwb commented Oct 29, 2020

Passing options to PHPUnit doesn't always work as expected, the docs state:

https://www.altis-dxp.com/resources/docs/dev-tools/testing-with-phpunit/

To pass any of the supported command line options to PHPUnit you need to add them after the options delimiter --. For example:

Running tests in a specific directory.

composer dev-tools phpunit -- content/themes/custom-theme/tests

Running tests with code coverage and junit reports.

composer dev-tools phpunit -- --coverage-xml coverage --log-junit junit.xml

The full list of PHPUnit command line options is available here or you can run composer dev-tools phpunit -- --help.

Steps to reproduce:

  1. From the terminal of a Altis install with the server running composer server start
  2. Run composer dev-tools phpunit -- --version

I expected to see the version of PHPUnit echo'd to the terminal

Instead I see the version of Composer: Composer version 1.10.16 2020-10-24 09:55:59

❯ composer dev-tools phpunit -- --version
Composer version 1.10.16 2020-10-24 09:55:59

I expected to see the same as when running PHPUnit directly from the /vendor folder:

❯ ./vendor/bin/phpunit --version
PHPUnit 7.1.5 by Sebastian Bergmann and contributors.

This is also reproducable with the docs example: composer dev-tools phpunit -- --help

Running this results in:

❯ composer dev-tools phpunit -- --help
Usage:
  dev-tools [options] [--] <subcommand> [<options>]...

Arguments:
  subcommand                     phpunit
  options                        

Options:
      --chassis                  Run commands in the Local Chassis environment
  -h, --help                     Display this help message
  -q, --quiet                    Do not output any message
  -V, --version                  Display this application version
      --ansi                     Force ANSI output
      --no-ansi                  Disable ANSI output
  -n, --no-interaction           Do not ask any interactive question
      --profile                  Display timing and memory usage information
      --no-plugins               Whether to disable plugins.
  -d, --working-dir=WORKING-DIR  If specified, use the given directory as working directory.
      --no-cache                 Prevent use of the cache
  -v|vv|vvv, --verbose           Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  Run a dev tools feature.
  
  To run PHPUnit integration tests:
      phpunit [--chassis] [--] [options]
                                  use `--` to separate arguments you want to
                                  pass to phpunit. Use the --chassis option
                                  if you are running Local Chassis.

This is the equivalent output of composer dev-tools --help which is the dev-tools help and not the phpunit help

Acceptance criteria:

  • ...
@ntwb ntwb added the bug Existing functionality isn't behaving as expected label Oct 29, 2020
@jennybeaumont jennybeaumont added the should have Should be done, medium priority for now label Nov 4, 2020
@johnbillion
Copy link
Member

This is a known bug in Composer, although I don't have the ticket to hand. The same problem exists for any custom Composer script.

@johnbillion
Copy link
Member

I think this can be closed as the problem is not specific to this library and the root cause is in symfony/console. See composer/composer#8165.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Existing functionality isn't behaving as expected should have Should be done, medium priority for now
Projects
None yet
Development

No branches or pull requests

4 participants