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

Remove --testdox parameter from phpunit command #63

Merged
merged 1 commit into from
Jun 13, 2024

Conversation

donquixote
Copy link
Contributor

The Issue

The test output from ddev phpunit has the following problems:

How does this happen?
Currently the phpunit command from this package calls phpunit with a --testdox parameter.
This parameter replaces the printer we previously set with --printer.

How This PR Solves The Issue

By removing the --testdox argument, we fall back to the Drupal output printer.
A developer can still manually append --testdox by running ddev phpunit --testdox, if they prefer that format.

Manual Testing Instructions

In a project with the ddev-drupal-contrib extension, create a test case like this:

use PHPUnit\Framework\TestCase;

class ExampleUnitTest extends TestCase {
  public function testFoo() {
    throw new \Exception('Outer', previous: new \Exception('Inner'));
  }
}

Optionally, add a Drupal web test (e.g. FunctionalJavascript) with a failed assertion.

Run ddev phpunit.

Expected:

  • For the ExampleUnitTest, we see the message and backtrace for "Inner" and "Outer" exceptions in the phpunit output.
  • For the web test, we see a section with "HTML output was generated", with a list of links.

Actual:

  • For the ExampleUnitTest, we don't see anything about "Inner" exception or its backtrace.
  • For the web test, we don't see the "HTML output was generated" section.

Automated Testing Overview

Not yet. I first want to see what fails by doing this change..

Related Issue Link(s)

Interesting post: #29 (comment)

Update .ddev/commands/web/phpunit command

Remove #ddev-generated from the top (line 3)
Remove --testdox from line 22

Release/Deployment Notes

The `--testdox` parameter replaces the printer we previously set with `--printer`.

This causes the following problems:
- The previous exception is not shown, see sebastianbergmann/phpunit#5863
- The "HTML output was generated" message from Drupal is not shown.

By removing the argument we fall back to the Drupal output printer. A developer can still manually append --testdox when running `ddev phpunit`.
@weitzman weitzman merged commit 7d2779e into ddev:main Jun 13, 2024
2 checks passed
@weitzman
Copy link
Collaborator

I like the output of testdox but it has unwanted byproduct, as you say.

@donquixote
Copy link
Contributor Author

Yeah I was going to write the output with --testdox is definitely pretty.
Maybe in a future version we can get it to work without the side effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants