From 99fd5c7b493471e2437ccfa7992656719b9e9c74 Mon Sep 17 00:00:00 2001 From: Lars Strojny Date: Tue, 18 Aug 2020 16:05:40 +0200 Subject: [PATCH] Add tests --- .../Repository/PlatformRepositoryTest.php | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/Composer/Test/Repository/PlatformRepositoryTest.php b/tests/Composer/Test/Repository/PlatformRepositoryTest.php index d90fcbc73..a608ed7ff 100644 --- a/tests/Composer/Test/Repository/PlatformRepositoryTest.php +++ b/tests/Composer/Test/Repository/PlatformRepositoryTest.php @@ -95,13 +95,28 @@ class PlatformRepositoryTest extends TestCase ), 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 */ - 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 @@ -123,7 +138,11 @@ class PlatformRepositoryTest extends TestCase ); $runtime ->method('invoke') - ->willReturnMap($functions); + ->willReturnMap($functionMap); + + $runtime + ->method('hasFunction') + ->willReturnMap($functionExists); $repository = new PlatformRepository(array(), array(), $runtime); foreach ($packages as $packageName => $version) {