8000 minor #54360 [Mime] use local PHP web server to test HTTP stream wrap… · symfony/symfony@914ce1e · GitHub
[go: up one dir, main page]

Skip to content

Commit 914ce1e

Browse files
committed
minor #54360 [Mime] use local PHP web server to test HTTP stream wrappers (xabbuh)
This PR was merged into the 5.4 branch. Discussion ---------- [Mime] use local PHP web server to test HTTP stream wrappers | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | | License | MIT Commits ------- 7d8f195 use local PHP web server to test HTTP stream wrappers
2 parents 26ba359 + 7d8f195 commit 914ce1e

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed
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
@@ -26,6 +26,7 @@
2626
"egulias/email-validator": "^2.1.10|^3.1|^4",
2727
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
2828
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
29+
"symfony/process": "^5.4|^6.4",
2930
"symfony/property-access": "^4.4|^5.1|^6.0",
3031
"symfony/property-info": "^4.4|^5.1|^6.0",
3132
"symfony/serializer": "^5.4.35|~6.3.12|^6.4.3"

0 commit comments

Comments
 (0)
0