1
0
Fork 0

Add tests

pull/9133/head
Lars Strojny 2020-08-18 16:05:40 +02:00
parent 4e06aa051a
commit 99fd5c7b49
No known key found for this signature in database
GPG Key ID: 887416A2AD3B0CA9
1 changed files with 21 additions and 2 deletions

View File

@ -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) {