1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00
This commit is contained in:
Jordi Boggiano 2022-08-17 15:20:07 +03:00 committed by GitHub
parent 6e205a0c84
commit 131da999ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
357 changed files with 5943 additions and 9174 deletions

View file

@ -71,11 +71,7 @@ class ProxyManagerTest extends TestCase
* @dataProvider dataRequest
*
* @param array<string, mixed> $server
* @param string $url
* @param string $expectedUrl
* @param mixed[] $expectedOptions
* @param bool $expectedSecure
* @param string $expectedMessage
*/
public function testGetProxyForRequest(array $server, string $url, string $expectedUrl, array $expectedOptions, bool $expectedSecure, string $expectedMessage): void
{
@ -102,34 +98,34 @@ class ProxyManagerTest extends TestCase
public function dataRequest(): array
{
$server = array(
$server = [
'http_proxy' => 'http://user:p%40ss@proxy.com',
'https_proxy' => 'https://proxy.com:443',
'no_proxy' => 'other.repo.org',
);
];
// server, url, expectedUrl, expectedOptions, expectedSecure, expectedMessage
return array(
array(array(), 'http://repo.org', '', array(), false, ''),
array($server, 'http://repo.org', 'http://user:p%40ss@proxy.com:80',
array('http' => array(
return [
[[], 'http://repo.org', '', [], false, ''],
[$server, 'http://repo.org', 'http://user:p%40ss@proxy.com:80',
['http' => [
'proxy' => 'tcp://proxy.com:80',
'header' => 'Proxy-Authorization: Basic dXNlcjpwQHNz',
'request_fulluri' => true,
)),
]],
false,
'http://user:***@proxy.com:80',
),
array(
],
[
$server, 'https://repo.org', 'https://proxy.com:443',
array('http' => array(
['http' => [
'proxy' => 'ssl://proxy.com:443',
)),
]],
true,
'https://proxy.com:443',
),
array($server, 'https://other.repo.org', '', array(), false, 'no_proxy'),
);
],
[$server, 'https://other.repo.org', '', [], false, 'no_proxy'],
];
}
/**
@ -157,19 +153,19 @@ class ProxyManagerTest extends TestCase
public function dataStatus(): array
{
// server, expectedStatus, expectedMessage
return array(
array(array(), false, null),
array(array('http_proxy' => 'localhost'), false, 'malformed'),
array(
array('http_proxy' => 'http://user:p%40ss@proxy.com:80'),
return [
[[], false, null],
[['http_proxy' => 'localhost'], false, 'malformed'],
[
['http_proxy' => 'http://user:p%40ss@proxy.com:80'],
true,
'http=http://user:***@proxy.com:80',
),
array(
array('http_proxy' => 'proxy.com:80', 'https_proxy' => 'proxy.com:80'),
],
[
['http_proxy' => 'proxy.com:80', 'https_proxy' => 'proxy.com:80'],
true,
'http=proxy.com:80, https=proxy.com:80',
),
);
],
];
}
}