Merge branch '4.4' into 5.2
* 4.4: fix tests (quinter)
This commit is contained in:
commit
e98baf5ea6
@ -44,6 +44,7 @@ before_install:
|
||||
# General configuration
|
||||
set -e
|
||||
stty cols 120
|
||||
sudo sed -i 's/127\.0\.1\.1 localhost/127.0.0.1 localhost/' /etc/hosts
|
||||
cp .github/composer-config.json "$(composer config home)/config.json"
|
||||
git config --global user.email ""
|
||||
git config --global user.name "Symfony"
|
||||
|
@ -38,8 +38,7 @@ class CurlHttpClientTest extends HttpClientTestCase
|
||||
public function testBindToPort()
|
||||
{
|
||||
$client = $this->getHttpClient(__FUNCTION__);
|
||||
$localhost = gethostbyname('localhost');
|
||||
$response = $client->request('GET', "http://$localhost:8057", ['bindto' => "$localhost:9876"]);
|
||||
$response = $client->request('GET', 'http://localhost:8057', ['bindto' => '127.0.0.1:9876']);
|
||||
$response->getStatusCode();
|
||||
|
||||
$r = new \ReflectionProperty($response, 'handle');
|
||||
@ -47,7 +46,7 @@ class CurlHttpClientTest extends HttpClientTestCase
|
||||
|
||||
$curlInfo = curl_getinfo($r->getValue($response));
|
||||
|
||||
self::assertSame($localhost, $curlInfo['local_ip']);
|
||||
self::assertSame('127.0.0.1', $curlInfo['local_ip']);
|
||||
self::assertSame(9876, $curlInfo['local_port']);
|
||||
}
|
||||
|
||||
|
@ -298,15 +298,13 @@ abstract class HttpClientTestCase extends BaseHttpClientTestCase
|
||||
self::markTestSkipped('Testing with the "vulcain" is not supported on Windows.');
|
||||
}
|
||||
|
||||
$localhost = gethostbyname('localhost');
|
||||
|
||||
if (['application/json'] !== $client->request('GET', "http://$localhost:8057/json")->getHeaders()['content-type']) {
|
||||
if (['application/json'] !== $client->request('GET', 'http://127.0.0.1:8057/json')->getHeaders()['content-type']) {
|
||||
self::markTestSkipped('symfony/http-client-contracts >= 2.0.1 required');
|
||||
}
|
||||
|
||||
$process = new Process(['vulcain'], null, [
|
||||
'DEBUG' => 1,
|
||||
'UPSTREAM' => "http://$localhost:8057",
|
||||
'UPSTREAM' => 'http://127.0.0.1:8057',
|
||||
'ADDR' => ':3000',
|
||||
'KEY_FILE' => __DIR__.'/Fixtures/tls/server.key',
|
||||
'CERT_FILE' => __DIR__.'/Fixtures/tls/server.crt',
|
||||
|
@ -23,7 +23,7 @@
|
||||
"require": {
|
||||
"php": ">=7.2.5",
|
||||
"psr/log": "^1.0",
|
||||
"symfony/http-client-contracts": "~2.2.1|~2.3.2|^2.4.1",
|
||||
"symfony/http-client-contracts": "^2.2",
|
||||
"symfony/polyfill-php73": "^1.11",
|
||||
"symfony/polyfill-php80": "^1.15",
|
||||
"symfony/service-contracts": "^1.0|^2"
|
||||
|
@ -30,7 +30,6 @@ 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:
|
||||
@ -42,7 +41,7 @@ switch ($vars['REQUEST_URI']) {
|
||||
|
||||
case '/':
|
||||
case '/?a=a&b=b':
|
||||
case "http://$localhost:8057/":
|
||||
case 'http://127.0.0.1:8057/':
|
||||
case 'http://localhost:8057/':
|
||||
ob_start('ob_gzhandler');
|
||||
break;
|
||||
@ -75,7 +74,7 @@ switch ($vars['REQUEST_URI']) {
|
||||
|
||||
case '/301':
|
||||
if ('Basic Zm9vOmJhcg==' === $vars['HTTP_AUTHORIZATION']) {
|
||||
header("Location: http://$localhost:8057/302", true, 301);
|
||||
header('Location: http://127.0.0.1:8057/302', true, 301);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -334,7 +334,6 @@ 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 +351,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$expected = [
|
||||
'HTTP/1.1 301 Moved Permanently',
|
||||
"Location: http://$localhost:8057/302",
|
||||
'Location: http://127.0.0.1:8057/302',
|
||||
'Content-Type: application/json',
|
||||
'HTTP/1.1 302 Found',
|
||||
'Location: http://localhost:8057/',
|
||||
@ -425,7 +424,6 @@ 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',
|
||||
@ -443,7 +441,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$expected = [
|
||||
'HTTP/1.1 301 Moved Permanently',
|
||||
"Location: http://$localhost:8057/302",
|
||||
'Location: http://127.0.0.1:8057/302',
|
||||
'Content-Type: application/json',
|
||||
'HTTP/1.1 302 Found',
|
||||
'Location: http://localhost:8057/',
|
||||
@ -692,9 +690,8 @@ 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' => $localhost],
|
||||
'resolve' => ['symfony.com' => '127.0.0.1'],
|
||||
]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
@ -708,16 +705,15 @@ 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' => $localhost],
|
||||
'resolve' => ['0-------------------------------------------------------------0.com' => '127.0.0.1'],
|
||||
]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
|
||||
$response = $client->request('GET', 'http://Bücher.example:8057/', [
|
||||
'resolve' => ['xn--bcher-kva.example' => $localhost],
|
||||
'resolve' => ['xn--bcher-kva.example' => '127.0.0.1'],
|
||||
]);
|
||||
|
||||
$this->assertSame(200, $response->getStatusCode());
|
||||
@ -885,7 +881,7 @@ abstract class HttpClientTestCase extends TestCase
|
||||
|
||||
$body = $response->toArray();
|
||||
$this->assertSame('localhost:8057', $body['HTTP_HOST']);
|
||||
$this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.\d+\.1):8057/$#', $body['REQUEST_URI']);
|
||||
$this->assertMatchesRegularExpression('#^http://(localhost|127\.0\.0\.1):8057/$#', $body['REQUEST_URI']);
|
||||
|
||||
$response = $client->request('GET', 'http://localhost:8057/', [
|
||||
'proxy' => 'http://foo:b%3Dar@localhost:8057',
|
||||
|
@ -28,16 +28,15 @@ 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', "$localhost:$port"]));
|
||||
$process = new Process(array_merge([$finder->find(false)], $finder->findArguments(), ['-dopcache.enable=0', '-dvariables_order=EGPCS', '-S', '127.0.0.1:'.$port]));
|
||||
$process->setWorkingDirectory(__DIR__.'/Fixtures/web');
|
||||
$process->start();
|
||||
self::$process[$port] = $process;
|
||||
|
||||
do {
|
||||
usleep(50000);
|
||||
} while (!@fopen("http://$localhost:$port", 'r'));
|
||||
} while (!@fopen('http://127.0.0.1:'.$port, 'r'));
|
||||
|
||||
return $process;
|
||||
}
|
||||
|
Reference in New Issue
Block a user