1
0
Fork 0

Add tests for #8861

pull/8916/head
Jordi Boggiano 2020-06-01 16:01:43 +02:00
parent a9affa8413
commit 537402f814
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
1 changed files with 25 additions and 1 deletions

View File

@ -1648,7 +1648,7 @@ EOF;
/** /**
* @dataProvider platformCheckProvider * @dataProvider platformCheckProvider
*/ */
public function testGeneratesPlatformCheck(array $requires, $expectedFixture, array $provides = array(), array $replaces = array()) public function testGeneratesPlatformCheck(array $requires, $expectedFixture, array $provides = array(), array $replaces = array(), $ignorePlatformReqs = false)
{ {
$package = new Package('a', '1.0', '1.0'); $package = new Package('a', '1.0', '1.0');
$package->setRequires($requires); $package->setRequires($requires);
@ -1665,6 +1665,7 @@ EOF;
->method('getCanonicalPackages') ->method('getCanonicalPackages')
->will($this->returnValue(array())); ->will($this->returnValue(array()));
$this->generator->setIgnorePlatformRequirements($ignorePlatformReqs);
$this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1'); $this->generator->dump($this->config, $this->repository, $package, $this->im, 'composer', true, '_1');
if (null === $expectedFixture) { if (null === $expectedFixture) {
@ -1714,6 +1715,29 @@ EOF;
), ),
'no_php_required' 'no_php_required'
), ),
'Ignoring all platform requirements skips check completely' => array(
array(
new Link('a', 'php', $versionParser->parseConstraints('^7.2')),
new Link('a', 'ext-xml', $versionParser->parseConstraints('*')),
new Link('a', 'ext-json', $versionParser->parseConstraints('*'))
),
null,
array(),
array(),
true
),
'Ignored platform requirements are not checked for' => array(
array(
new Link('a', 'php', $versionParser->parseConstraints('^7.2.8')),
new Link('a', 'ext-xml', $versionParser->parseConstraints('*')),
new Link('a', 'ext-json', $versionParser->parseConstraints('*')),
new Link('a', 'ext-pdo', $versionParser->parseConstraints('*'))
),
'no_php_required',
array(),
array(),
array('php', 'ext-pdo')
),
'No extensions required' => array( 'No extensions required' => array(
array( array(
new Link('a', 'php', $versionParser->parseConstraints('^7.2')), new Link('a', 'php', $versionParser->parseConstraints('^7.2')),