Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Mime] use local PHP web server to test HTTP stream wrappers #54360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 src/Symfony/Component/Mime/Tests/Fixtures/web/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
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 16 src/Symfony/Component/Mime/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 1 src/Symfony/Component/Mime/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"egulias/email-validator": "^2.1.10|^3.1|^4",
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
"symfony/dependency-injection": "^4.4|^5.0|^6.0",
"symfony/process": "^5.4|^6.4",
"symfony/property-access": "^4.4|^5.1|^6.0",
"symfony/property-info": "^4.4|^5.1|^6.0",
"symfony/serializer": "^5.4.35|~6.3.12|^6.4.3"
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.