|
|
|
@ -96,9 +96,6 @@ class PlatformRepositoryTest extends TestCase
|
|
|
|
|
array(
|
|
|
|
|
array('inet_pton', array('::'), ''),
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
array('inet_pton', true),
|
|
|
|
|
)
|
|
|
|
|
),
|
|
|
|
|
array(
|
|
|
|
|
array(
|
|
|
|
@ -107,16 +104,15 @@ class PlatformRepositoryTest extends TestCase
|
|
|
|
|
array(
|
|
|
|
|
'php' => '7.2.31',
|
|
|
|
|
),
|
|
|
|
|
array(),
|
|
|
|
|
array(
|
|
|
|
|
'inet_pton' => false,
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
array('inet_pton', array('::'), false),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/** @dataProvider getPhpFlavorTestCases */
|
|
|
|
|
public function testPhpVersion(array $constants, array $packages, array $functionMap = array(), array $functionExists = array())
|
|
|
|
|
public function testPhpVersion(array $constants, array $packages, array $functions = array())
|
|
|
|
|
{
|
|
|
|
|
$runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock();
|
|
|
|
|
$runtime
|
|
|
|
@ -138,11 +134,7 @@ class PlatformRepositoryTest extends TestCase
|
|
|
|
|
);
|
|
|
|
|
$runtime
|
|
|
|
|
->method('invoke')
|
|
|
|
|
->willReturnMap($functionMap);
|
|
|
|
|
|
|
|
|
|
$runtime
|
|
|
|
|
->method('hasFunction')
|
|
|
|
|
->willReturnMap($functionExists);
|
|
|
|
|
->willReturnMap($functions);
|
|
|
|
|
|
|
|
|
|
$repository = new PlatformRepository(array(), array(), $runtime);
|
|
|
|
|
foreach ($packages as $packageName => $version) {
|
|
|
|
@ -152,6 +144,39 @@ class PlatformRepositoryTest extends TestCase
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testInetPtonRegressiom()
|
|
|
|
|
{
|
|
|
|
|
$runtime = $this->getMockBuilder('Composer\Platform\Runtime')->getMock();
|
|
|
|
|
|
|
|
|
|
$runtime
|
|
|
|
|
->expects(self::once())
|
|
|
|
|
->method('invoke')
|
|
|
|
|
->with('inet_pton', array('::'))
|
|
|
|
|
->willReturn(false);
|
|
|
|
|
$runtime
|
|
|
|
|
->method('hasConstant')
|
|
|
|
|
->willReturnMap(
|
|
|
|
|
array(
|
|
|
|
|
array('PHP_ZTS', false),
|
|
|
|
|
array('AF_INET6', false),
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$runtime
|
|
|
|
|
->method('getExtensions')
|
|
|
|
|
->willReturn(array());
|
|
|
|
|
$runtime
|
|
|
|
|
->method('getConstant')
|
|
|
|
|
->willReturnMap(
|
|
|
|
|
array(
|
|
|
|
|
array('PHP_VERSION', null, '7.0.0'),
|
|
|
|
|
array('PHP_DEBUG', null, false),
|
|
|
|
|
)
|
|
|
|
|
);
|
|
|
|
|
$repository = new PlatformRepository(array(), array(), $runtime);
|
|
|
|
|
$package = $repository->findPackage('php-ipv6', '*');
|
|
|
|
|
self::assertNull($package);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function getLibraryTestCases()
|
|
|
|
|
{
|
|
|
|
|
return array(
|
|
|
|
|