run tests with PHPUnit 12.1 on PHP >= 8.3

This commit is contained in:
Christian Flothmann
2025-08-04 14:35:27 +02:00
parent 14f8bb0226
commit 71d3ef7380
2 changed files with 28 additions and 10 deletions

View File

@@ -14,6 +14,7 @@ namespace Symfony\Component\Process\Tests;
use PHPUnit\Framework\Attributes\RunInSeparateProcess;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Process\Process;
/**
* @author Chris Smith <chris@cs278.org>
@@ -122,17 +123,11 @@ class ExecutableFinderTest extends TestCase
$this->markTestSkipped('Cannot test when open_basedir is set');
}
putenv('PATH='.\dirname(\PHP_BINARY));
$initialOpenBaseDir = ini_set('open_basedir', \dirname(\PHP_BINARY).\PATH_SEPARATOR.'/');
$process = new Process([\PHP_BINARY, '-d', 'open_basedir='.\dirname(\PHP_BINARY).\PATH_SEPARATOR.'/', __DIR__.'/Fixtures/open_basedir.php']);
$process->run();
$result = $process->getOutput();
try {
$finder = new ExecutableFinder();
$result = $finder->find($this->getPhpBinaryName());
$this->assertSamePath(\PHP_BINARY, $result);
} finally {
ini_set('open_basedir', $initialOpenBaseDir);
}
$this->assertSamePath(\PHP_BINARY, $result);
}
#[RunInSeparateProcess]

View File

@@ -0,0 +1,23 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
require_once __DIR__.'/../../ExecutableFinder.php';
use Symfony\Component\Process\ExecutableFinder;
putenv('PATH='.dirname(PHP_BINARY));
function getPhpBinaryName(): string
{
return basename(PHP_BINARY, '\\' === DIRECTORY_SEPARATOR ? '.exe' : '');
}
echo (new ExecutableFinder())->find(getPhpBinaryName());