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
-------
7341e29f2f
Fix tests (bis)
This commit is contained in:
commit
ad5b25e390
@ -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"
|
||||
},
|
||||
|
@ -65,7 +65,8 @@ class MimeTypeTest extends TestCase
|
||||
|
||||
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()
|
||||
|
@ -20,4 +20,9 @@ class FileBinaryMimeTypeGuesserTest extends AbstractMimeTypeGuesserTest
|
||||
{
|
||||
return new FileBinaryMimeTypeGuesser();
|
||||
}
|
||||
|
||||
public function testGuessWithDuplicatedFileType()
|
||||
{
|
||||
$this->markTestSkipped('Result varies depending on the OS');
|
||||
}
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ foreach ($_SERVER as $k => $v) {
|
||||
}
|
||||
|
||||
$json = json_encode($vars, \JSON_PRETTY_PRINT | \JSON_UNESCAPED_SLASHES | \JSON_UNESCAPED_UNICODE);
|
||||
$localhost = gethostbyname('localhost');
|
||||
|
||||
switch ($vars['REQUEST_URI']) {
|
||||
default:
|
||||
@ -41,7 +42,7 @@ switch ($vars['REQUEST_URI']) {
|
||||
|
||||
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;
|
||||
@ -74,7 +75,7 @@ switch ($vars['REQUEST_URI']) {
|
||||
|
||||
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;
|
||||
|
||||
|
@ -335,6 +335,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
public function testRedirects()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$localhost = gethostbyname('localhost');
|
||||
$response = $client->request('POST', 'http://localhost:8057/301', [
|
||||
'auth_basic' => 'foo:bar',
|
||||
'body' => function () {
|
||||
@ -352,7 +353,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$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/',
|
||||
@ -425,6 +426,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
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',
|
||||
@ -442,7 +444,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$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/',
|
||||
@ -691,8 +693,9 @@ abstract class HttpClientTestCase extends TestCase
|
||||
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());
|
||||
@ -706,15 +709,16 @@ abstract class HttpClientTestCase extends TestCase
|
||||
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());
|
||||
|
@ -31,15 +31,16 @@ class TestHttpServer
|
||||
});
|
||||
}
|
||||
|
||||
$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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user