Skip to content

Commit 08cb7c9

Browse files
committed
Merge branch '7.0' into 7.1
* 7.0: update constraint [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 7.0.7 Update VERSION for 7.0.6 Update CHANGELOG for 7.0.6 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 42dd7ec + 9fe06c8 commit 08cb7c9

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

Tests/Part/DataPartTest.php

+22-19
Original file line numberDiff line numberDiff line change
@@ -138,32 +138,35 @@ public function testFromPathWithNotAFile()
138138

139139
public function testFromPathWithUrl()
140140
{
141-
if (!\in_array('https', stream_get_wrappers(), true)) {
142-
$this->markTestSkipped('"https" stream wrapper is not enabled.');
141+
if (!\in_array('http', stream_get_wrappers(), true)) {
142+
$this->markTestSkipped('"http" stream wrapper is not enabled.');
143143
}
144144

145145
$finder = new PhpExecutableFinder();
146146
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:8057']));
147147
$process->setWorkingDirectory(__DIR__.'/../Fixtures/web');
148148
$process->start();
149149

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');
155-
$content = file_get_contents($file);
156-
$this->assertEquals($content, $p->getBody());
157-
$maxLineLength = 76;
158-
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr($p->bodyToString(), 0, $maxLineLength));
159-
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr(implode('', iterator_to_array($p->bodyToIterable())), 0, $maxLineLength));
160-
$this->assertEquals('image', $p->getMediaType());
161-
$this->assertEquals('png', $p->getMediaSubType());
162-
$this->assertEquals(new Headers(
163-
new ParameterizedHeader('Content-Type', 'image/png', ['name' => 'logo_symfony_header.png']),
164-
new UnstructuredHeader('Content-Transfer-Encoding', 'base64'),
165-
new ParameterizedHeader('Content-Disposition', 'attachment', ['name' => 'logo_symfony_header.png', 'filename' => 'logo_symfony_header.png'])
166-
), $p->getPreparedHeaders());
150+
try {
151+
do {
152+
usleep(50000);
153+
} while (!@fopen('http://127.0.0.1:8057', 'r'));
154+
$p = DataPart::fromPath($file = 'http://localhost:8057/logo_symfony_header.png');
155+
$content = file_get_contents($file);
156+
$this->assertEquals($content, $p->getBody());
157+
$maxLineLength = 76;
158+
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr($p->bodyToString(), 0, $maxLineLength));
159+
$this->assertEquals(substr(base64_encode($content), 0, $maxLineLength), substr(implode('', iterator_to_array($p->bodyToIterable())), 0, $maxLineLength));
160+
$this->assertEquals('image', $p->getMediaType());
161+
$this->assertEquals('png', $p->getMediaSubType());
162+
$this->assertEquals(new Headers(
163+
new ParameterizedHeader('Content-Type', 'image/png', ['name' => 'logo_symfony_header.png']),
164+
new UnstructuredHeader('Content-Transfer-Encoding', 'base64'),
165+
new ParameterizedHeader('Content-Disposition', 'attachment', ['name' => 'logo_symfony_header.png', 'filename' => 'logo_symfony_header.png'])
166+
), $p->getPreparedHeaders());
167+
} finally {
168+
$process->stop();
169+
}
167170
}
168171

169172
public function testHasContentId()

0 commit comments

Comments
 (0)