Skip to content

Re evaluate PHPUnit CLI options #177

@Jean85

Description

@Jean85

After #174, PHPUnit CLI options should be re evaluated. Any option that doesn't affect Paraunit's behavior should be dropped, while newer ones should be incorporated and passed through. In this issue, We will cover just writing a self-documenting test that will extrapolate the situation of each option (so that it could be linked from the docs) and emit a warning when a new option is discovered.

Unusable

Done in #195: These options should be incompatible with Paraunit; we should document fail when detecting those (see #174)

This list is available in here in the code:

private const DISALLOWED_OPTIONS = [
'--no-configuration',
'--no-extensions',
'--no-logging',
'--coverage-php',
'--teamcity',
'--testdox',
'--atleast-version',
'--check-version',
'--generate-configuration',
'--migrate-configuration',
'--list-suites',
'--list-groups',
'--list-tests',
'--list-tests-xml',
];

To be handled in the future

To be ignored / used with --passthrough

The following options should be only listed in the test as allowed, so that no warning is triggered in the self-documenting test: are listed in this test data provider for the self-documenting test:

private function getAlreadySupportedOptions(): array
{
$coverageCommand = new CoverageCommand($this->prophesize(CoverageConfiguration::class)->reveal());
$supportedOptions = array_map(
static fn (InputOption $option): string => '--' . $option->getName(),
$coverageCommand->getDefinition()->getOptions(),
);
$supportedOptions[] = '--filter';
$supportedOptions[] = '--help';
$supportedOptions[] = '--version';
// TODO - map coverage modes automatically
$supportedOptions[] = '--coverage-clover';
$supportedOptions[] = '--coverage-html';
$supportedOptions[] = '--coverage-xml';
$supportedOptions[] = '--coverage-text';
$supportedOptions[] = '--coverage-crap4j';
return array_values($supportedOptions);
}

Usable

The following options are usable with --pass-through and listed in this test data provider for the self-documenting test:

public static function allowedOptionsDataProvider(): array
{
return [
['--bootstrap', '<file>'],
['--include-path <path(s)>'],
['-d <key[=value]>'],
['--cache-directory', '<dir>'],
['--testsuite', '<name>'],
['--group', '<name>'],
['--exclude-group', '<name>'],
['--covers', '<name>'],
['--uses', '<name>'],
['--process-isolation'],
['--globals-backup'],
['--static-backup'],
['--strict-coverage'],
['--strict-global-state'],
['--disallow-test-output'],
['--enforce-time-limit'],
['--default-time-limit', '<sec>'],
['--cache-result'],
['--do-not-cache-result'],
['--colors', '<flag>'],
['--stderr'],
['--no-progress'],
['--no-output'],
['--log-junit', '<file>'],
['--log-teamcity', '<file>'],
['--testdox-html', '<file>'],
['--testdox-text', '<file>'],
['--log-events-text', '<file>'],
['--log-events-verbose-text', '<file>'],
['--coverage-filter', '<filter>'],
['--disable-coverage-ignore'],
['--path-coverage'],
['--no-coverage'],
['--include-path'],
// TODO - add dedicated tests?
['--fail-on-incomplete'],
['--fail-on-risky'],
['--fail-on-skipped'],
['--fail-on-warning'],
['--dont-report-useless-tests'],
];
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions