mirror of
https://github.com/symfony/process.git
synced 2026-03-23 23:42:06 +01:00
run tests with PHPUnit 12.1 on PHP >= 8.3
This commit is contained in:
@@ -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]
|
||||
|
||||
23
Tests/Fixtures/open_basedir.php
Normal file
23
Tests/Fixtures/open_basedir.php
Normal 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());
|
||||
Reference in New Issue
Block a user