Skip to content

Commit

Permalink
Update PHPUnit compatibility to 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Slamdunk committed Apr 14, 2023
1 parent a8bd9b7 commit 063f514
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 16 deletions.
16 changes: 8 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,23 +40,23 @@
"ext-simplexml": "*",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
"jean85/pretty-package-versions": "^2.0.5",
"phpunit/php-code-coverage": "^10.0.2",
"phpunit/php-code-coverage": "^10.1.0",
"phpunit/php-file-iterator": "^4.0.1",
"phpunit/php-timer": "^6.0",
"phpunit/phpunit": "^10.0.17",
"sebastian/environment": "^6.0",
"symfony/console": "^6.2.7",
"symfony/process": "^6.2.7"
"phpunit/phpunit": "^10.1.0",
"sebastian/environment": "^6.0.1",
"symfony/console": "^6.2.8",
"symfony/process": "^6.2.8"
},
"require-dev": {
"ext-pcov": "*",
"ext-posix": "*",
"doctrine/coding-standard": "^11.1.0",
"infection/infection": "^0.26.19",
"phpstan/phpstan": "^1.10.7",
"phpstan/phpstan": "^1.10.13",
"phpstan/phpstan-deprecation-rules": "^1.1.3",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5",
"phpstan/phpstan-phpunit": "^1.3.11",
"phpstan/phpstan-strict-rules": "^1.5.1",
"squizlabs/php_codesniffer": "^3.7.2",
"symfony/filesystem": "^6.2.7"
},
Expand Down
6 changes: 4 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
beStrictAboutChangesToGlobalState="true"
beStrictAboutOutputDuringTests="true"
cacheDirectory=".phpunit.cache">
<coverage>
<source>
<include>
<directory suffix=".php">src</directory>
<directory>src</directory>
</include>
</source>
<coverage>
<report>
<text outputFile="php://stdout" showOnlySummary="true"/>
</report>
Expand Down
18 changes: 15 additions & 3 deletions src/WrapperRunner/ApplicationForWrapperWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,18 @@ private function bootstrap(): void
EventFacade::emitter()->testRunnerBootstrapFinished($bootstrapFilename);
}

$extensionRequiresCodeCoverageCollection = false;
if (! $this->configuration->noExtensions()) {
if ($this->configuration->hasPharExtensionDirectory()) {
(new PharLoader())->loadPharExtensionsInDirectory(
$this->configuration->pharExtensionDirectory(),
);
}

$extensionFacade = new ExtensionFacade();
$extensionBootstrapper = new ExtensionBootstrapper(
$this->configuration,
new ExtensionFacade(),
$extensionFacade,
);

foreach ($this->configuration->extensionBootstrappers() as $bootstrapper) {
Expand All @@ -113,9 +115,15 @@ private function bootstrap(): void
$bootstrapper['parameters'],
);
}

$extensionRequiresCodeCoverageCollection = $extensionFacade->requiresCodeCoverageCollection();
}

CodeCoverage::instance()->init($this->configuration, CodeCoverageFilterRegistry::instance());
CodeCoverage::instance()->init(
$this->configuration,
CodeCoverageFilterRegistry::instance(),
$extensionRequiresCodeCoverageCollection,
);

if ($this->configuration->hasLogfileJunit()) {
new JunitXmlLogger(
Expand All @@ -126,9 +134,13 @@ private function bootstrap(): void

new ProgressPrinter(
DefaultPrinter::from($this->progressFile),
EventFacade::instance(),
false,
120,
EventFacade::instance(),
$this->configuration->source(),
$this->configuration->restrictDeprecations(),
$this->configuration->restrictNotices(),
$this->configuration->restrictWarnings(),
);

if (isset($this->teamcityFile)) {
Expand Down
12 changes: 9 additions & 3 deletions src/WrapperRunner/WrapperRunner.php
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,13 @@ private function complete(TestResult $testResultSum): int
$this->generateLogs();

$exitcode = (new ShellExitCodeCalculator())->calculate(
$this->options->configuration->failOnDeprecation(),
$this->options->configuration->failOnEmptyTestSuite(),
$this->options->configuration->failOnRisky(),
$this->options->configuration->failOnWarning(),
$this->options->configuration->failOnIncomplete(),
$this->options->configuration->failOnNotice(),
$this->options->configuration->failOnRisky(),
$this->options->configuration->failOnSkipped(),
$this->options->configuration->failOnWarning(),
$testResultSum,
);

Expand All @@ -314,7 +316,11 @@ protected function generateCodeCoverageReports(): void
}

$coverageManager = new CodeCoverage();
$coverageManager->init($this->options->configuration, $this->codeCoverageFilterRegistry);
$coverageManager->init(
$this->options->configuration,
$this->codeCoverageFilterRegistry,
false,
);
$coverageMerger = new CoverageMerger($coverageManager->codeCoverage());
foreach ($this->coverageFiles as $coverageFile) {
$coverageMerger->addCoverageFromFile($coverageFile);
Expand Down

0 comments on commit 063f514

Please sign in to comment.