Skip to content

Commit

Permalink
Merge branch '6.4' into 7.0
Browse files Browse the repository at this point in the history
* 6.4:
  preserve the file modification time when mirroring directories
  use local PHP web server to test HTTP stream wrappers
  • Loading branch information
xabbuh committed Mar 21, 2024
2 parents c1ffe24 + 14762b8 commit 9936240
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions Tests/Fixtures/web/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
Binary file added Tests/Fixtures/web/logo_symfony_header.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 12 additions & 4 deletions Tests/Part/DataPartTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
use Symfony\Component\Mime\Header\ParameterizedHeader;
use Symfony\Component\Mime\Header\UnstructuredHeader;
use Symfony\Component\Mime\Part\DataPart;
use Symfony\Component\Process\PhpExecutableFinder;
use Symfony\Component\Process\Process;

class DataPartTest extends TestCase
{
Expand Down Expand Up @@ -134,16 +136,22 @@ public function testFromPathWithNotAFile()
DataPart::fromPath(__DIR__.'/../Fixtures/mimetypes/');
}

/**
* @group network
*/
public function testFromPathWithUrl()
{
if (!\in_array('https', stream_get_wrappers())) {
$this->markTestSkipped('"https" stream wrapper is not enabled.');
}

$p = DataPart::fromPath($file = 'https://symfony.com/images/common/logo/logo_symfony_header.png');
$finder = new PhpExecutableFinder();
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
$process->setWorkingDirectory(__DIR__.'/../Fixtures/web');
$process->start();

do {
usleep(50000);
} while (!@fopen('http://127.0.0.1:8057', 'r'));

$p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png');
$content = file_get_contents($file);
$this->assertEquals($content, $p->getBody());
$maxLineLength = 76;
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"league/html-to-markdown": "^5.0",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/dependency-injection": "^6.4|^7.0",
"symfony/process": "^6.4|^7.0",
"symfony/property-access": "^6.4|^7.0",
"symfony/property-info": "^6.4|^7.0",
"symfony/serializer": "^6.4|^7.0"
Expand Down

0 comments on commit 9936240

Please sign in to comment.