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

Fix tests (bis) #41581

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
Jun 7, 2021
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/HttpClient/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"php-http/httplug": "^1.0|^2.0",
"psr/http-client": "^1.0",
"symfony/dependency-injection": "^4.3|^5.0",
"symfony/http-client-contracts": "^1.1.11|~2.1.4|~2.2.1|~2.3.2|^2.4.1",
"symfony/http-kernel": "^4.4.13",
"symfony/process": "^4.2|^5.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ public function testGuessFileWithUnknownExtension()

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

public function testGuessWithIncorrectPath()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,9 @@ protected function getGuesser(): MimeTypeGuesserInterface
{
return new FileBinaryMimeTypeGuesser();
}

public function testGuessWithDuplicatedFileType()
{
$this->markTestSkipped('Result varies depending on the OS');
}
}
5 changes: 3 additions & 2 deletions 5 src/Symfony/Contracts/HttpClient/Test/Fixtures/web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
}

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

switch ($vars['REQUEST_URI']) {
default:
Expand All @@ -41,7 +42,7 @@

case '/':
case '/?a=a&b=b':
case 'http://127.0.0.1:8057/':
case "http://$localhost:8057/":
case 'http://localhost:8057/':
ob_start('ob_gzhandler');
break;
Expand Down Expand Up @@ -74,7 +75,7 @@

case '/301':
if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) {
header('Location: http://127.0.0.1:8057/302', true, 301);
header("Location: http://$localhost:8057/302", true, 301);
}
break;

Expand Down
14 changes: 9 additions & 5 deletions 14 src/Symfony/Contracts/HttpClient/Test/HttpClientTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ public function test304()
public function testRedirects()
{
$client = $this->getHttpClient(__FUNCTION__);
$localhost = gethostbyname('localhost');
$response = $client->request('POST', 'http://localhost:8057/301', [
'auth_basic' => 'foo:bar',
'body' => function () {
Expand All @@ -352,7 +353,7 @@ public function testRedirects()

$expected = [
'HTTP/1.1 301 Moved Permanently',
'Location: http://127.0.0.1:8057/302',
"Location: http://$localhost:8057/302",
'Content-Type: application/json',
'HTTP/1.1 302 Found',
'Location: http://localhost:8057/',
Expand Down Expand Up @@ -425,6 +426,7 @@ public function testRedirect307()
public function testMaxRedirects()
{
$client = $this->getHttpClient(__FUNCTION__);
$localhost = gethostbyname('localhost');
$response = $client->request('GET', 'http://localhost:8057/301', [
'max_redirects' => 1,
'auth_basic' => 'foo:bar',
Expand All @@ -442,7 +444,7 @@ public function testMaxRedirects()

$expected = [
'HTTP/1.1 301 Moved Permanently',
'Location: http://127.0.0.1:8057/302',
"Location: http://$localhost:8057/302",
'Content-Type: application/json',
'HTTP/1.1 302 Found',
'Location: http://localhost:8057/',
Expand Down Expand Up @@ -691,8 +693,9 @@ public function testOnProgressError()
public function testResolve()
{
$client = $this->getHttpClient(__FUNCTION__);
$localhost = gethostbyname('localhost');
$response = $client->request('GET', 'http://symfony.com:8057/', [
'resolve' => ['symfony.com' => '127.0.0.1'],
'resolve' => ['symfony.com' => $localhost],
]);

$this->assertSame(200, $response->getStatusCode());
Expand All @@ -706,15 +709,16 @@ public function testResolve()
public function testIdnResolve()
{
$client = $this->getHttpClient(__FUNCTION__);
$localhost = gethostbyname('localhost');

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

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

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

$this->assertSame(200, $response->getStatusCode());
Expand Down
5 changes: 3 additions & 2 deletions 5 src/Symfony/Contracts/HttpClient/Test/TestHttpServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,16 @@ public static function start(int $port = 8057)
});
}

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

do {
usleep(50000);
} while (!@fopen('http://127.0.0.1:'.$port, 'r'));
} while (!@fopen("http://$localhost:$port", 'r'));

return $process;
}
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.