Skip to content

Commit

Permalink
[6.x] Add Symfony 7 support (#822)
Browse files Browse the repository at this point in the history
Co-authored-by: Filippo Tessarotto <[email protected]>
  • Loading branch information
kbond and Slamdunk authored Oct 31, 2023
1 parent d6f32a9 commit 8083a42
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 12 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,23 @@
"ext-pcre": "*",
"ext-reflection": "*",
"ext-simplexml": "*",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1",
"fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0",
"jean85/pretty-package-versions": "^2.0.5",
"phpunit/php-code-coverage": "^9.2.25",
"phpunit/php-file-iterator": "^3.0.6",
"phpunit/php-timer": "^5.0.3",
"phpunit/phpunit": "^9.6.4",
"sebastian/environment": "^5.1.5",
"symfony/console": "^5.4.21 || ^6.2.7",
"symfony/process": "^5.4.21 || ^6.2.7"
"symfony/console": "^5.4.28 || ^6.3.4 || ^7.0.0",
"symfony/process": "^5.4.28 || ^6.3.4 || ^7.0.0"
},
"require-dev": {
"ext-pcov": "*",
"ext-posix": "*",
"doctrine/coding-standard": "^10.0.0",
"infection/infection": "^0.26.19",
"doctrine/coding-standard": "^12.0.0",
"infection/infection": "^0.27.6",
"squizlabs/php_codesniffer": "^3.7.2",
"symfony/filesystem": "^5.4.21 || ^6.2.7",
"symfony/filesystem": "^5.4.25 || ^6.3.1 || ^7.0.0",
"vimeo/psalm": "^5.7.7"
},
"autoload": {
Expand Down
1 change: 1 addition & 0 deletions src/Console/Commands/ParaTestCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ final class ParaTestCommand extends Command
public function __construct(string $cwd, ?string $name = null)
{
$this->cwd = $cwd;

parent::__construct($name);
}

Expand Down
3 changes: 3 additions & 0 deletions src/Logging/JUnit/Reader.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public function __construct(string $logFile)

private function parseTestSuite(SimpleXMLElement $node, bool $isRootSuite): TestSuite
{
assert($node->testsuite !== null);

if ($isRootSuite) {
foreach ($node->testsuite as $singleTestSuiteXml) {
return $this->parseTestSuite($singleTestSuiteXml, false);
Expand All @@ -63,6 +65,7 @@ private function parseTestSuite(SimpleXMLElement $node, bool $isRootSuite): Test
$suites[$testSuite->name] = $testSuite;
}

assert($node->testcase !== null);
$cases = [];
foreach ($node->testcase as $singleTestCase) {
$cases[] = TestCase::caseFromNode($singleTestCase);
Expand Down
8 changes: 4 additions & 4 deletions src/Logging/JUnit/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,10 @@ class_exists($type)
if ((string) $node['class'] !== '') {
$text = sprintf(
"%s::%s\n\n%s:%s",
$node['class'],
$node['name'],
$node['file'],
$node['line'],
(string) $node['class'],
(string) $node['name'],
(string) $node['file'],
(int) $node['line'],
);
}

Expand Down
1 change: 1 addition & 0 deletions src/Runners/PHPUnit/Suite.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ final class Suite extends ExecutableTest
public function __construct(string $path, array $functions, bool $needsCoverage, bool $needsTeamcity, string $tmpDir)
{
parent::__construct($path, $needsCoverage, $needsTeamcity, $tmpDir);

$this->functions = $functions;
}

Expand Down
1 change: 1 addition & 0 deletions src/Runners/PHPUnit/TestMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ final class TestMethod extends ExecutableTest
public function __construct(string $testPath, array $filters, bool $needsCoverage, bool $needsTeamcity, string $tmpDir)
{
parent::__construct($testPath, $needsCoverage, $needsTeamcity, $tmpDir);

// for compatibility with other code (tests), which can pass string (one filter)
// instead of array of filters
$this->filters = $filters;
Expand Down
2 changes: 1 addition & 1 deletion test/Unit/Runners/PHPUnit/OptionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ public function testColors(bool $expected, ?string $phpunitConfig, array $option
self::assertSame($expected, $this->createOptionsFromArgv($options, __DIR__, $hasColorSupport)->colors());
}

/** @return array<int, array<int, (false|array<string, (null|string)>|null)>> */
/** @return array<int, array<int, (false|array<string, (string|null)>|null)>> */
public function provideColorsCases(): array
{
return [
Expand Down
4 changes: 3 additions & 1 deletion test/Unit/Runners/PHPUnit/WrapperRunnerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace ParaTest\Tests\Unit\Runners\PHPUnit;

use InvalidArgumentException;
use ParaTest\Runners\PHPUnit\RunnerInterface;
use ParaTest\Runners\PHPUnit\WrapperRunner;

use function array_diff;
Expand All @@ -28,7 +29,8 @@ final class WrapperRunnerTest extends RunnerTestCase
{
protected const NUMBER_OF_CLASS_TESTS_FOR_BATCH_SIZE = 4;
protected const UNPROCESSABLE_FILENAMES = ['..', '.', '.gitignore'];
/** {@inheritdoc } */

/** @var class-string<RunnerInterface> */
protected $runnerClass = WrapperRunner::class;

public function testWrapperRunnerNotAvailableInFunctionalMode(): void
Expand Down

0 comments on commit 8083a42

Please sign in to comment.