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

Refactor how the test runner uses configuration from CLI options and XML file #4292

Closed
sebastianbergmann opened this issue Jun 15, 2020 · 1 comment
Assignees
Labels
feature/test-runner CLI test runner type/refactoring A refactoring that should be applied to make the code easier to understand and maintain
Milestone

Comments

@sebastianbergmann
Copy link
Owner

The PHPUnit\TextUI\XmlConfiguration\Configuration object was introduced in PHPUnit 9.0. It holds the configuration loaded from an XML configuration file.

The PHPUnit\TextUI\CliArguments\Configuration object was introduced in PHPUnit 9.2. It holds the configuration passed using commandline arguments and options.

The test runner uses PHPUnit\TextUI\XmlConfiguration\Loader to load an XML configuration file and create an PHPUnit\TextUI\XmlConfiguration\Configuration object.

The test runner uses PHPUnit\TextUI\CliArguments\Builder to process commandline arguments and options to create an PHPUnit\TextUI\CliArguments\Configuration object. The test runner then uses PHPUnit\TextUI\CliArguments\Mapper::mapToLegacyArray() to map the PHPUnit\TextUI\CliArguments\Configuration object to an $arguments array that is required by the legacy code in PHPUnit\TextUI\TestRunner.

PHPUnit\TextUI\TestRunner is full of code that is hard to understand and maintain for "mixing" the configuration that comes from the XML configuration file in the form of an PHPUnit\TextUI\XmlConfiguration\Configuration object and from the commandline in the form of an $arguments array that is created by PHPUnit\TextUI\CliArguments\Mapper::mapToLegacyArray().

Replacing this overly complicated and error-prone code should be the next step in refactoring the code responsible for configuring the test runner.

@sebastianbergmann sebastianbergmann added type/refactoring A refactoring that should be applied to make the code easier to understand and maintain feature/test-runner CLI test runner labels Jun 15, 2020
@sebastianbergmann sebastianbergmann added this to the PHPUnit 9.3 milestone Jun 15, 2020
@sebastianbergmann sebastianbergmann self-assigned this Jun 15, 2020
@sebastianbergmann sebastianbergmann removed this from the PHPUnit 9.4 milestone Sep 28, 2020
@sebastianbergmann sebastianbergmann added this to the PHPUnit 10.0 milestone Jun 9, 2021
@sebastianbergmann
Copy link
Owner Author

I started to work on this in the issue-4292/refactor-test-runner-configuration branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/refactoring A refactoring that should be applied to make the code easier to understand and maintain
Projects
None yet
Development

No branches or pull requests

2 participants