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

Commit ad5b25e

Browse filesBrowse files
minor #41581 Fix tests (bis) (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- Fix tests (bis) | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | - | License | MIT | Doc PR | - Commits ------- 7341e29 Fix tests (bis)
2 parents fb79727 + 7341e29 commit ad5b25e
Copy full SHA for ad5b25e

File tree

Expand file treeCollapse file tree

6 files changed

+23
-10
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+23
-10
lines changed

‎src/Symfony/Component/HttpClient/composer.json

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpClient/composer.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"php-http/httplug": "^1.0|^2.0",
3434
"psr/http-client": "^1.0",
3535
"symfony/dependency-injection": "^4.3|^5.0",
36+
"symfony/http-client-contracts": "^1.1.11|~2.1.4|~2.2.1|~2.3.2|^2.4.1",
3637
"symfony/http-kernel": "^4.4.13",
3738
"symfony/process": "^4.2|^5.0"
3839
},

‎src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpFoundation/Tests/File/MimeType/MimeTypeTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ public function testGuessFileWithUnknownExtension()
6565

6666
public function testGuessWithDuplicatedFileType()
6767
{
68-
$this->assertSame('application/vnd.openxmlformats-officedocument.wordprocessingml.document', MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test.docx'));
68+
$type = MimeTypeGuesser::getInstance()->guess(__DIR__.'/../Fixtures/test.docx');
69+
$this->assertTrue(\in_array($type, ['application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'], true));
6970
}
7071

7172
public function testGuessWithIncorrectPath()

‎src/Symfony/Component/Mime/Tests/FileBinaryMimeTypeGuesserTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Mime/Tests/FileBinaryMimeTypeGuesserTest.php
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,9 @@ protected function getGuesser(): MimeTypeGuesserInterface
2020
{
2121
return new FileBinaryMimeTypeGuesser();
2222
}
23+
24+
public function testGuessWithDuplicatedFileType()
25+
{
26+
$this->markTestSkipped('Result varies depending on the OS');
27+
}
2328
}

‎src/Symfony/Contracts/HttpClient/Test/Fixtures/web/index.php

Copy file name to clipboardExpand all lines: src/Symfony/Contracts/HttpClient/Test/Fixtures/web/index.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
}
3131

3232
$json = json_encode($vars, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
33+
$localhost = gethostbyname('localhost');
3334

3435
switch ($vars['REQUEST_URI']) {
3536
default:
@@ -41,7 +42,7 @@
4142

4243
case '/':
4344
case '/?a=a&b=b':
44-
case 'http://127.0.0.1:8057/':
45+
case "http://$localhost:8057/":
4546
case 'http://localhost:8057/':
4647
ob_start('ob_gzhandler');
4748
break;
@@ -74,7 +75,7 @@
7475

7576
case '/301':
7677
if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) {
77-
header('Location: http://127.0.0.1:8057/302', true, 301);
78+
header("Location: http://$localhost:8057/302", true, 301);
7879
}
7980
break;
8081

‎src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php

Copy file name to clipboardExpand all lines: src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
+9-5Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ public function test304()
335335
public function testRedirects()
336336
{
337337
$client = $this->getHttpClient(__FUNCTION__);
338+
$localhost = gethostbyname('localhost');
338339
$response = $client->request('POST', 'http://localhost:8057/301', [
339340
'auth_basic' => 'foo:bar',
340341
'body' => function () {
@@ -352,7 +353,7 @@ public function testRedirects()
352353

353354
$expected = [
354355
'HTTP/1.1 301 Moved Permanently',
355-
'Location: http://127.0.0.1:8057/302',
356+
"Location: http://$localhost:8057/302",
356357
'Content-Type: application/json',
357358
'HTTP/1.1 302 Found',
358359
'Location: http://localhost:8057/',
@@ -425,6 +426,7 @@ public function testRedirect307()
425426
public function testMaxRedirects()
426427
{
427428
$client = $this->getHttpClient(__FUNCTION__);
429+
$localhost = gethostbyname('localhost');
428430
$response = $client->request('GET', 'http://localhost:8057/301', [
429431
'max_redirects' => 1,
430432
'auth_basic' => 'foo:bar',
@@ -442,7 +444,7 @@ public function testMaxRedirects()
442444

443445
$expected = [
444446
'HTTP/1.1 301 Moved Permanently',
445-
'Location: http://127.0.0.1:8057/302',
447+
"Location: http://$localhost:8057/302",
446448
'Content-Type: application/json',
447449
'HTTP/1.1 302 Found',
448450
'Location: http://localhost:8057/',
@@ -691,8 +693,9 @@ public function testOnProgressError()
691693
public function testResolve()
692694
{
693695
$client = $this->getHttpClient(__FUNCTION__);
696+
$localhost = gethostbyname('localhost');
694697
$response = $client->request('GET', 'http://symfony.com:8057/', [
695-
'resolve' => ['symfony.com' => '127.0.0.1'],
698+
'resolve' => ['symfony.com' => $localhost],
696699
]);
697700

698701
$this->assertSame(200, $response->getStatusCode());
@@ -706,15 +709,16 @@ public function testResolve()
706709
public function testIdnResolve()
707710
{
708711
$client = $this->getHttpClient(__FUNCTION__);
712+
$localhost = gethostbyname('localhost');
709713

710714
$response = $client->request('GET', 'http://0-------------------------------------------------------------0.com:8057/', [
711-
'resolve' => ['0-------------------------------------------------------------0.com' => '127.0.0.1'],
715+
'resolve' => ['0-------------------------------------------------------------0.com' => $localhost],
712716
]);
713717

714718
$this->assertSame(200, $response->getStatusCode());
715719

716720
$response = $client->request('GET', 'http://Bücher.example:8057/', [
717-
'resolve' => ['xn--bcher-kva.example' => '127.0.0.1'],
721+
'resolve' => ['xn--bcher-kva.example' => $localhost],
718722
]);
719723

720724
$this->assertSame(200, $response->getStatusCode());

‎src/Symfony/Contracts/HttpClient/Test/TestHttpServer.php

Copy file name to clipboardExpand all lines: src/Symfony/Contracts/HttpClient/Test/TestHttpServer.php
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,16 @@ public static function start(int $port = 8057)
3131
});
3232
}
3333

34+
$localhost = gethostbyname('localhost');
3435
$finder = new PhpExecutableFinder();
35-
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port]));
36+
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', "$localhost:$port"]));
3637
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
3738
$process->start();
3839
self::$process[$port] = $process;
3940

4041
do {
4142
usleep(50000);
42-
} while (!@fopen('http://127.0.0.1:'.$port, 'r'));
43+
} while (!@fopen("http://$localhost:$port", 'r'));
4344

4445
return $process;
4546
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.