8000 Merge branch '6.4' into 7.0 · symfony/symfony@ed617c8 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed617c8

Browse files
committed
Merge branch '6.4' into 7.0
* 6.4: preserve the file modification time when mirroring directories use local PHP web server to test HTTP stream wrappers
2 parents 278574d + 5e4f67e commit ed617c8

File tree

5 files changed

+17
-4
lines changed

5 files changed

+17
-4
lines changed

src/Symfony/Component/Filesystem/Filesystem.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ public function copy(string $originFile, string $targetFile, bool $overwriteNewe
7272
// Like `cp`, preserve executable permission bits
7373
self::box('chmod', $targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
7474

75+
// Like `cp`, preserve the file modification time
76+
self::box('touch', $targetFile, filemtime($originFile));
77+
7578
if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
7679
throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
7780
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?php
Loading

src/Symfony/Component/Mime/Tests/Part/DataPartTest.php

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
use Symfony\Component\Mime\Header\ParameterizedHeader;
1919
use Symfony\Component\Mime\Header\UnstructuredHeader;
2020
use Symfony\Component\Mime\Part\DataPart;
21+
use Symfony\Component\Process\PhpExecutableFinder;
22+
use Symfony\Component\Process\Process;
2123

2224
class DataPartTest extends TestCase
2325
{
@@ -134,16 +136,22 @@ public function testFromPathWithNotAFile()
134136
DataPart::fromPath(__DIR__.'/../Fixtures/mimetypes/');
135137
}
136138

137-
/**
138-
* @group network
139-
*/
140139
public function testFromPathWithUrl()
141140
{
142141
if (!\in_array('https', stream_get_wrappers())) {
143142
$this->markTestSkipped('"https" stream wrapper is not enabled.');
144143
}
145144

146-
$p = DataPart::fromPath($file = 'https://symfony.com/images/common/logo/logo_symfony_header.png');
145+
$finder = new PhpExecutableFinder();
146+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
147+
$process->setWorkingDirectory(__DIR__.'/../Fixtures/web');
148+
$process->start();
149+
150+
do {
151+
usleep(50000);
152+
} while (!@fopen('http://127.0.0.1:8057', 'r'));
153+
154+
$p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png');
147155
$content = file_get_contents($file);
148156
$this->assertEquals($content, $p->getBody());
149157
$maxLineLength = 76;

src/Symfony/Component/Mime/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
"league/html-to-markdown": "^5.0",
2626
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
2727
"symfony/dependency-injection": "^6.4|^7.0",
28+
"symfony/process": "^6.4|^7.0",
2829
"symfony/property-access": "^6.4|^7.0",
2930
"symfony/property-info": "^6.4|^7.0",
3031
"symfony/serializer": "^6.4|^7.0"

0 commit comments

Comments
 (0)
0