Skip to content

Commit 39de712

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: [FrameworkBundle] fixes #54402: Suppress PHP warning when is_readable() tries to access dirs outside of open_basedir restrictions return null when message with name is not set use local PHP web server to test HTTP stream wrappers [Translation] Silence error when intl not loaded Bump Symfony version to 6.4.7 Update VERSION for 6.4.6 Update CHANGELOG for 6.4.6 Bump Symfony version to 5.4.39 Update VERSION for 5.4.38 Update CONTRIBUTORS for 5.4.38 Update CHANGELOG for 5.4.38
2 parents 408105d + c882f88 commit 39de712

File tree

4 files changed

+25
-12
lines changed

4 files changed

+25
-12
lines changed

Diff for: Tests/FilesystemTest.php

+22-11
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
use Symfony\Component\Filesystem\Exception\InvalidArgumentException;
1515
use Symfony\Component\Filesystem\Exception\IOException;
1616
use Symfony\Component\Filesystem\Path;
17+
use Symfony\Component\Process\PhpExecutableFinder;
18+
use Symfony\Component\Process\Process;
1719

1820
/**
1921
* Test class for Filesystem.
@@ -162,23 +164,32 @@ public function testCopyCreatesTargetDirectoryIfItDoesNotExist()
162164
$this->assertStringEqualsFile($targetFilePath, 'SOURCE FILE');
163165
}
164166

165-
/**
166-
* @group network
167-
*/
168167
public function testCopyForOriginUrlsAndExistingLocalFileDefaultsToCopy()
169168
{
170-
if (!\in_array('https', stream_get_wrappers())) {
171-
$this->markTestSkipped('"https" stream wrapper is not enabled.');
169+
if (!\in_array('http', stream_get_wrappers())) {
170+
$this->markTestSkipped('"http" stream wrapper is not enabled.');
172171
}
173-
$sourceFilePath = 'https://symfony.com/images/common/logo/logo_symfony_header.png';
174-
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
175172

176-
file_put_contents($targetFilePath, 'TARGET FILE');
173+
$finder = new PhpExecutableFinder();
174+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
175+
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
177176

178-
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);
177+
$process->start();
179178

180-
$this->assertFileExists($targetFilePath);
181-
$this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
179+
do {
180+
usleep(50000);
181+
} while (!@fopen('http://127.0.0.1:8057', 'r'));
182+
183+
try {
184+
$sourceFilePath = 'http://localhost:8057/logo_symfony_header.png';
185+
$targetFilePath = $this->workspace.\DIRECTORY_SEPARATOR.'copy_target_file';
186+
file_put_contents($targetFilePath, 'TARGET FILE');
187+
$this->filesystem->copy($sourceFilePath, $targetFilePath, false);
188+
$this->assertFileExists($targetFilePath);
189+
$this->assertEquals(file_get_contents($sourceFilePath), file_get_contents($targetFilePath));
190+
} finally {
191+
$process->stop();
192+
}
182193
}
183194

184195
public function testMkdirCreatesDirectoriesRecursively()

Diff for: Tests/Fixtures/web/index.php

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php

Diff for: Tests/Fixtures/web/logo_symfony_header.png

1.58 KB
Loading

Diff for: composer.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
"require": {
1919
"php": ">=8.2",
2020
"symfony/polyfill-ctype": "~1.8",
21-
"symfony/polyfill-mbstring": "~1.8"
21+
"symfony/polyfill-mbstring": "~1.8",
22+
"symfony/process": "^5.4|^6.4"
2223
},
2324
"autoload": {
2425
"psr-4": { "Symfony\\Component\\Filesystem\\": "" },

0 commit comments

Comments
 (0)