8000 Remove symfony/console < 4.4 hack as minimum supported version is 5.4 by sidz · Pull Request #1888 · infection/infection · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove symfony/console < 4.4 hack as minimum supported version is 5.4 #1888

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 4 additions & 16 deletions src/Process/Factory/InitialTestsRunProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,9 @@

namespace Infection\Process\Factory;

use Composer\InstalledVersions;
use Infection\AbstractTestFramework\TestFrameworkAdapter;
use Infection\Process\OriginalPhpProcess;
use function method_exists;
use Symfony\Component\Process\Process;
use function version_compare;

/**
* @internal
Expand All @@ -65,22 +62,13 @@ public function createProcess(
// If we're expecting to receive a code coverage, test process must run in a vanilla environment
$processClass = $skipCoverage ? Process::class : OriginalPhpProcess::class;

/** @var Process $process */
$process = new $processClass(
$this->testFrameworkAdapter->getInitialTestRunCommandLine(
return new $processClass(
command: $this->testFrameworkAdapter->getInitialTestRunCommandLine(
$testFrameworkExtraOptions,
$phpExtraOptions,
$skipCoverage
)
),
timeout: null // Ignore the default timeout of 60 seconds
);

$process->setTimeout(null); // Ignore the default timeout of 60 seconds

if (method_exists($process, 'inheritEnvironmentVariables') && version_compare((string) InstalledVersions::getPrettyVersion('symfony/console'), 'v4.4', '<')) {
// In version 4.4.0 this method is deprecated and removed in 5.0.0
$process->inheritEnvironmentVariables();
}

return $process;
}
}
15 changes: 3 additions & 12 deletions src/Process/Factory/MutantProcessFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,13 @@

namespace Infection\Process\Factory;

use Composer\InstalledVersions;
use Infection\AbstractTestFramework\TestFrameworkAdapter;
use Infection\Event\EventDispatcher\EventDispatcher;
use Infection\Event\MutantProcessWasFinished;
use Infection\Mutant\Mutant;
use Infection\Mutant\MutantExecutionResultFactory;
use Infection\Process\MutantProcess;
use function method_exists;
use Symfony\Component\Process\Process;
use function version_compare;

/**
* @internal
Expand All @@ -60,22 +57,16 @@ public function __construct(private readonly TestFrameworkAdapter $testFramework
public function createProcessForMutant(Mutant $mutant, string $testFrameworkExtraOptions = ''): MutantProcess
{
$process = new Process(
$this->testFrameworkAdapter->getMutantCommandLine(
command: $this->testFrameworkAdapter->getMutantCommandLine(
$mutant->getTests(),
$mutant->getFilePath(),
$mutant->getMutation()->getHash(),
$mutant->getMutation()->getOriginalFilePath(),
$testFrameworkExtraOptions
)
),
timeout: $this->timeout
);

$process->setTimeout($this->timeout);

if (method_exists($process, 'inheritEnvironmentVariables') && version_compare((string) InstalledVersions::getPrettyVersion('symfony/console'), 'v4.4', '<')) {
// in version 4.4.0 this method is deprecated and removed in 5.0.0
$process->inheritEnvironmentVariables();
}

$mutantProcess = new MutantProcess($process, $mutant);

$eventDispatcher = $this->eventDispatcher;
Expand Down
0