Skip to content

Commit

Permalink
Add configuration options for #5196
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Feb 20, 2023
1 parent 72cdda6 commit d86b26d
Show file tree
Hide file tree
Showing 9 changed files with 542 additions and 322 deletions.
16 changes: 10 additions & 6 deletions phpunit.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -172,18 +172,22 @@
<xs:attribute name="columns" type="columnsType" default="80"/>
<xs:attribute name="requireCoverageMetadata" type="xs:boolean" default="false"/>
<xs:attribute name="processIsolation" type="xs:boolean" default="false"/>
<xs:attribute name="failOnDeprecation" type="xs:boolean" default="false"/>
<xs:attribute name="failOnEmptyTestSuite" type="xs:boolean" default="false"/>
<xs:attribute name="failOnIncomplete" type="xs:boolean" default="false"/>
<xs:attribute name="failOnNotice" type="xs:boolean" default="false"/>
<xs:attribute name="failOnRisky" type="xs:boolean" default="false"/>
<xs:attribute name="failOnSkipped" type="xs:boolean" default="false"/>
<xs:attribute name="failOnWarning" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnDefect" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnDeprecation" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnError" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnFailure" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnWarning" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnIncomplete" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnNotice" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnRisky" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnSkipped" type="xs:boolean" default="false"/>
<xs:attribute name="failOnEmptyTestSuite" type="xs:boolean" default="false"/>
<xs:attribute name="failOnIncomplete" type="xs:boolean" default="false"/>
<xs:attribute name="failOnRisky" type="xs:boolean" default="false"/>
<xs:attribute name="failOnSkipped" type="xs:boolean" default="false"/>
<xs:attribute name="failOnWarning" type="xs:boolean" default="false"/>
<xs:attribute name="stopOnWarning" type="xs:boolean" default="false"/>
<xs:attribute name="beStrictAboutChangesToGlobalState" type="xs:boolean" default="false"/>
<xs:attribute name="beStrictAboutOutputDuringTests" type="xs:boolean" default="false"/>
<xs:attribute name="beStrictAboutTestsThatDoNotTestAnything" type="xs:boolean" default="true"/>
Expand Down
24 changes: 14 additions & 10 deletions src/Framework/TestSuite.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ class TestSuite implements IteratorAggregate, Reorderable, SelfDescribing, Test
private array $tests = [];
private ?array $providedTests = null;
private ?Factory $iteratorFilter = null;
private readonly bool $stopOnDefect;
private readonly bool $stopOnDeprecation;
private readonly bool $stopOnError;
private readonly bool $stopOnFailure;
private readonly bool $stopOnWarning;
private readonly bool $stopOnRisky;
private readonly bool $stopOnIncomplete;
private readonly bool $stopOnNotice;
private readonly bool $stopOnRisky;
private readonly bool $stopOnSkipped;
private readonly bool $stopOnDefect;
private readonly bool $stopOnWarning;

public static function empty(string $name = null): static
{
Expand Down Expand Up @@ -150,13 +152,15 @@ final private function __construct(string $name)

$configuration = Registry::get();

$this->stopOnError = $configuration->stopOnError();
$this->stopOnFailure = $configuration->stopOnFailure();
$this->stopOnWarning = $configuration->stopOnWarning();
$this->stopOnRisky = $configuration->stopOnRisky();
$this->stopOnIncomplete = $configuration->stopOnIncomplete();
$this->stopOnSkipped = $configuration->stopOnSkipped();
$this->stopOnDefect = $configuration->stopOnDefect();
$this->stopOnDeprecation = $configuration->stopOnDeprecation();
$this->stopOnDefect = $configuration->stopOnDefect();
$this->stopOnError = $configuration->stopOnError();
$this->stopOnFailure = $configuration->stopOnFailure();
$this->stopOnIncomplete = $configuration->stopOnIncomplete();
$this->stopOnNotice = $configuration->stopOnNotice();
$this->stopOnRisky = $configuration->stopOnRisky();
$this->stopOnSkipped = $configuration->stopOnSkipped();
$this->stopOnWarning = $configuration->stopOnWarning();
}

/**
Expand Down
120 changes: 76 additions & 44 deletions src/TextUI/Configuration/Cli/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,22 @@ final class Builder
'reverse-list',
'static-backup',
'stderr',
'fail-on-deprecation',
'fail-on-empty-test-suite',
'fail-on-incomplete',
'fail-on-notice',
'fail-on-risky',
'fail-on-skipped',
'fail-on-warning',
'stop-on-defect',
'stop-on-deprecation',
'stop-on-error',
'stop-on-failure',
'stop-on-warning',
'stop-on-incomplete',
'stop-on-notice',
'stop-on-risky',
'stop-on-skipped',
'fail-on-empty-test-suite',
'fail-on-incomplete',
'fail-on-risky',
'fail-on-skipped',
'fail-on-warning',
'stop-on-warning',
'strict-coverage',
'disable-coverage-ignore',
'strict-global-state',
Expand Down Expand Up @@ -174,11 +178,22 @@ public function fromParameters(array $parameters): Configuration
$excludeGroups = null;
$executionOrder = null;
$executionOrderDefects = null;
$failOnDeprecation = null;
$failOnEmptyTestSuite = null;
$failOnIncomplete = null;
$failOnNotice = null;
$failOnRisky = null;
$failOnSkipped = null;
$failOnWarning = null;
$stopOnDefect = null;
$stopOnDeprecation = null;
$stopOnError = null;
$stopOnFailure = null;
$stopOnIncomplete = null;
$stopOnNotice = null;
$stopOnRisky = null;
$stopOnSkipped = null;
$stopOnWarning = null;
$filter = null;
$generateConfiguration = false;
$migrateConfiguration = false;
Expand Down Expand Up @@ -206,13 +221,6 @@ public function fromParameters(array $parameters): Configuration
$reverseList = null;
$stderr = null;
$strictCoverage = null;
$stopOnDefect = null;
$stopOnError = null;
$stopOnFailure = null;
$stopOnIncomplete = null;
$stopOnRisky = null;
$stopOnSkipped = null;
$stopOnWarning = null;
$teamcityLogfile = null;
$testdoxHtmlFile = null;
$testdoxTextFile = null;
Expand Down Expand Up @@ -504,63 +512,83 @@ public function fromParameters(array $parameters): Configuration

break;

case '--stop-on-defect':
$stopOnDefect = true;
case '--fail-on-deprecation':
$failOnDeprecation = true;

break;

case '--stop-on-error':
$stopOnError = true;
case '--fail-on-empty-test-suite':
$failOnEmptyTestSuite = true;

break;

case '--stop-on-failure':
$stopOnFailure = true;
case '--fail-on-incomplete':
$failOnIncomplete = true;

break;

case '--stop-on-warning':
$stopOnWarning = true;
case '--fail-on-notice':
$failOnNotice = true;

break;

case '--stop-on-incomplete':
$stopOnIncomplete = true;
case '--fail-on-risky':
$failOnRisky = true;

break;

case '--stop-on-risky':
$stopOnRisky = true;
case '--fail-on-skipped':
$failOnSkipped = true;

break;

case '--stop-on-skipped':
$stopOnSkipped = true;
case '--fail-on-warning':
$failOnWarning = true;

break;

case '--fail-on-empty-test-suite':
$failOnEmptyTestSuite = true;
case '--stop-on-defect':
$stopOnDefect = true;

break;

case '--fail-on-incomplete':
$failOnIncomplete = true;
case '--stop-on-deprecation':
$stopOnDeprecation = true;

break;

case '--fail-on-risky':
$failOnRisky = true;
case '--stop-on-error':
$stopOnError = true;

break;

case '--fail-on-skipped':
$failOnSkipped = true;
case '--stop-on-failure':
$stopOnFailure = true;

break;

case '--fail-on-warning':
$failOnWarning = true;
case '--stop-on-incomplete':
$stopOnIncomplete = true;

break;

case '--stop-on-notice':
$stopOnNotice = true;

break;

case '--stop-on-risky':
$stopOnRisky = true;

break;

case '--stop-on-skipped':
$stopOnSkipped = true;

break;

case '--stop-on-warning':
$stopOnWarning = true;

break;

Expand Down Expand Up @@ -801,11 +829,22 @@ public function fromParameters(array $parameters): Configuration
$excludeGroups,
$executionOrder,
$executionOrderDefects,
$failOnDeprecation,
$failOnEmptyTestSuite,
$failOnIncomplete,
$failOnNotice,
$failOnRisky,
$failOnSkipped,
$failOnWarning,
$stopOnDefect,
$stopOnDeprecation,
$stopOnError,
$stopOnFailure,
$stopOnIncomplete,
$stopOnNotice,
$stopOnRisky,
$stopOnSkipped,
$stopOnWarning,
$filter,
$generateConfiguration,
$migrateConfiguration,
Expand Down Expand Up @@ -833,13 +872,6 @@ public function fromParameters(array $parameters): Configuration
$reverseList,
$stderr,
$strictCoverage,
$stopOnDefect,
$stopOnError,
$stopOnFailure,
$stopOnIncomplete,
$stopOnRisky,
$stopOnSkipped,
$stopOnWarning,
$teamcityLogfile,
$testdoxHtmlFile,
$testdoxTextFile,
Expand Down
Loading

0 comments on commit d86b26d

Please sign in to comment.