mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Add back abandoned key in repository search results (#10259)
This commit is contained in:
parent
d7154c2a72
commit
5b47fa1896
5 changed files with 78 additions and 3 deletions
|
@ -216,6 +216,55 @@ class ComposerRepositoryTest extends TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testSearchWithAbandonedPackages()
|
||||
{
|
||||
$repoConfig = array(
|
||||
'url' => 'http://example.org',
|
||||
);
|
||||
|
||||
$result = array(
|
||||
'results' => array(
|
||||
array(
|
||||
'name' => 'foo1',
|
||||
'description' => null,
|
||||
'abandoned' => true,
|
||||
),
|
||||
array(
|
||||
'name' => 'foo2',
|
||||
'description' => null,
|
||||
'abandoned' => 'bar',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$httpDownloader = $this->getMockBuilder('Composer\Util\HttpDownloader')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$eventDispatcher = $this->getMockBuilder('Composer\EventDispatcher\EventDispatcher')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
|
||||
$httpDownloader->expects($this->at(1))
|
||||
->method('get')
|
||||
->with($url = 'http://example.org/packages.json')
|
||||
->willReturn(new \Composer\Util\Http\Response(array('url' => $url), 200, array(), json_encode(array('search' => '/search.json?q=%query%'))));
|
||||
|
||||
$httpDownloader->expects($this->at(2))
|
||||
->method('get')
|
||||
->with($url = 'http://example.org/search.json?q=foo')
|
||||
->willReturn(new \Composer\Util\Http\Response(array('url' => $url), 200, array(), json_encode($result)));
|
||||
|
||||
$repository = new ComposerRepository($repoConfig, new NullIO, FactoryMock::createConfig(), $httpDownloader, $eventDispatcher);
|
||||
|
||||
$this->assertSame(
|
||||
array(
|
||||
array('name' => 'foo1', 'description' => null, 'abandoned' => true),
|
||||
array('name' => 'foo2', 'description' => null, 'abandoned' => 'bar'),
|
||||
),
|
||||
$repository->search('foo')
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider provideCanonicalizeUrlTestCases
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue