mirror of
https://github.com/composer/composer
synced 2025-05-08 16:17:37 +00:00
Merge branch 'master' into 2.0
* master: (48 commits) SVN: hide passwords for debug output Free $solver asap fixes #8179 [minor] Fixed a typo in the CHANGELOG.md. Update deps Update changelog Revert "Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET" Revert "Add docs for COMPOSER_SELF_UPDATE_TARGET, refs #8151" Add docs for COMPOSER_SELF_UPDATE_TARGET, refs #8151 Fix display of HHVM warning appearing when HHVM is not in use, fixes #8138 Read classmap-authoritative and apcu-autoloader from project config when installing via create-project, fixes #8155 Use possessive quantifiers Update xdebug-handler to 1.3.3 fixes #8159 Allow overriding self-update target file with envvar COMPOSER_SELF_UPDATE_TARGET flag should come before script name use full command name, not abbreviated/alias modify text Document the alternatives to disable the default script timeout Anchor pattern Fix URL resolution for Composer repositories ...
This commit is contained in:
commit
d2fa1e1319
36 changed files with 779 additions and 205 deletions
|
@ -214,4 +214,71 @@ class ComposerRepositoryTest extends TestCase
|
|||
$repository->search('foo', RepositoryInterface::SEARCH_FULLTEXT, 'library')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider canonicalizeUrlProvider
|
||||
*
|
||||
* @param string $expected
|
||||
* @param string $url
|
||||
* @param string $repositoryUrl
|
||||
*/
|
||||
public function testCanonicalizeUrl($expected, $url, $repositoryUrl)
|
||||
{
|
||||
$repository = new ComposerRepository(
|
||||
array('url' => $repositoryUrl),
|
||||
new NullIO(),
|
||||
FactoryMock::createConfig()
|
||||
);
|
||||
|
||||
$object = new \ReflectionObject($repository);
|
||||
|
||||
$method = $object->getMethod('canonicalizeUrl');
|
||||
$method->setAccessible(true);
|
||||
|
||||
// ComposerRepository::__construct ensures that the repository URL has a
|
||||
// protocol, so reset it here in order to test all cases.
|
||||
$property = $object->getProperty('url');
|
||||
$property->setAccessible(true);
|
||||
$property->setValue($repository, $repositoryUrl);
|
||||
|
||||
$this->assertSame($expected, $method->invoke($repository, $url));
|
||||
}
|
||||
|
||||
public function canonicalizeUrlProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
'https://example.org/path/to/file',
|
||||
'/path/to/file',
|
||||
'https://example.org',
|
||||
),
|
||||
array(
|
||||
'https://example.org/canonic_url',
|
||||
'https://example.org/canonic_url',
|
||||
'https://should-not-see-me.test',
|
||||
),
|
||||
array(
|
||||
'file:///path/to/repository/file',
|
||||
'/path/to/repository/file',
|
||||
'file:///path/to/repository',
|
||||
),
|
||||
array(
|
||||
// Assert that the repository URL is returned unchanged if it is
|
||||
// not a URL.
|
||||
// (Backward compatibility test)
|
||||
'invalid_repo_url',
|
||||
'/path/to/file',
|
||||
'invalid_repo_url',
|
||||
),
|
||||
array(
|
||||
// Assert that URLs can contain sequences resembling pattern
|
||||
// references as understood by preg_replace() without messing up
|
||||
// the result.
|
||||
// (Regression test)
|
||||
'https://example.org/path/to/unusual_$0_filename',
|
||||
'/path/to/unusual_$0_filename',
|
||||
'https://example.org',
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue