mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Fix package search not urlencoding the input (#10500)
This commit is contained in:
parent
e7c04e3e12
commit
3d82719b70
2 changed files with 31 additions and 1 deletions
|
@ -202,6 +202,36 @@ class ComposerRepositoryTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testSearchWithSpecialChars()
|
||||
{
|
||||
$repoConfig = array(
|
||||
'url' => 'http://example.org',
|
||||
);
|
||||
|
||||
$result = array(
|
||||
'results' => array(
|
||||
array(
|
||||
'name' => 'foo',
|
||||
'description' => null,
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$httpDownloader = new HttpDownloaderMock(array(
|
||||
'http://example.org/packages.json' => JsonFile::encode(array('search' => '/search.json?q=%query%&type=%type%')),
|
||||
'http://example.org/search.json?q=foo+bar&type=' => JsonFile::encode(array()),
|
||||
));
|
||||
$eventDispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$repository = new ComposerRepository($repoConfig, new NullIO, FactoryMock::createConfig(), $httpDownloader, $eventDispatcher);
|
||||
|
||||
$this->assertEmpty(
|
||||
$repository->search('foo bar', RepositoryInterface::SEARCH_FULLTEXT)
|
||||
);
|
||||
}
|
||||
|
||||
public function testSearchWithAbandonedPackages()
|
||||
{
|
||||
$repoConfig = array(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue