Refactor how the test runner uses configuration from CLI options and XML file #4292
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
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 anPHPUnit\TextUI\XmlConfiguration\Configuration
object.The test runner uses
PHPUnit\TextUI\CliArguments\Builder
to process commandline arguments and options to create anPHPUnit\TextUI\CliArguments\Configuration
object. The test runner then usesPHPUnit\TextUI\CliArguments\Mapper::mapToLegacyArray()
to map thePHPUnit\TextUI\CliArguments\Configuration
object to an$arguments
array that is required by the legacy code inPHPUnit\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 anPHPUnit\TextUI\XmlConfiguration\Configuration
object and from the commandline in the form of an$arguments
array that is created byPHPUnit\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.
The text was updated successfully, but these errors were encountered: