mirror of
https://github.com/composer/composer
synced 2025-05-09 08:32:56 +00:00
Add tests
This commit is contained in:
parent
4e06aa051a
commit
99fd5c7b49
1 changed files with 21 additions and 2 deletions
|
@ -95,13 +95,28 @@ class PlatformRepositoryTest extends TestCase
|
||||||
),
|
),
|
||||||
array(
|
array(
|
||||||
array('inet_pton', array('::'), ''),
|
array('inet_pton', array('::'), ''),
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array('inet_pton', true),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
array(
|
||||||
|
'PHP_VERSION' => '7.2.31-1+ubuntu16.04.1+deb.sury.org+1',
|
||||||
|
),
|
||||||
|
array(
|
||||||
|
'php' => '7.2.31',
|
||||||
|
),
|
||||||
|
array(),
|
||||||
|
array(
|
||||||
|
'inet_pton' => false,
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @dataProvider getPhpFlavorTestCases */
|
/** @dataProvider getPhpFlavorTestCases */
|
||||||
public function testPhpVersion(array $constants, array $packages, array $functions = array())
|
public function testPhpVersion(array $constants, array $packages, array $functionMap = array(), array $functionExists = array())
|
||||||
{
|
{
|
||||||
$runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock();
|
$runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock();
|
||||||
$runtime
|
$runtime
|
||||||
|
@ -123,7 +138,11 @@ class PlatformRepositoryTest extends TestCase
|
||||||
);
|
);
|
||||||
$runtime
|
$runtime
|
||||||
->method('invoke')
|
->method('invoke')
|
||||||
->willReturnMap($functions);
|
->willReturnMap($functionMap);
|
||||||
|
|
||||||
|
$runtime
|
||||||
|
->method('hasFunction')
|
||||||
|
->willReturnMap($functionExists);
|
||||||
|
|
||||||
$repository = new PlatformRepository(array(), array(), $runtime);
|
$repository = new PlatformRepository(array(), array(), $runtime);
|
||||||
foreach ($packages as $packageName => $version) {
|
foreach ($packages as $packageName => $version) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue