mirror of
https://github.com/composer/composer
synced 2025-05-09 00:22:53 +00:00
Refactor commit-ref validation
The require and require-dev arrays have been merged into one and no longer user private methods/properties to collect warnings.
This commit is contained in:
parent
476c6f279b
commit
f3dc31839f
2 changed files with 23 additions and 47 deletions
|
@ -27,22 +27,11 @@ class ConfigValidatorTest extends TestCase
|
|||
public function testConfigValidatorCommitRefWarning()
|
||||
{
|
||||
$configValidator = new ConfigValidator(new NullIO());
|
||||
$reflection = new \ReflectionClass(get_class($configValidator));
|
||||
$method = $reflection->getMethod('checkForCommitReferences');
|
||||
$warnings = $reflection->getProperty('warnings');
|
||||
list(, , $warnings) = $configValidator->validate(__DIR__ . '/Fixtures/composer_commit-ref.json');
|
||||
|
||||
$method->setAccessible(true);
|
||||
$warnings->setAccessible(true);
|
||||
|
||||
$this->assertEquals(0, count($warnings->getValue($configValidator)));
|
||||
|
||||
$method->invokeArgs($configValidator, array(
|
||||
array(
|
||||
'some-package' => 'dev-master#62c4da6',
|
||||
'another-package' => '^1.0.0'
|
||||
)
|
||||
$this->assertEquals(true, in_array(
|
||||
'The package "some/package" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
|
||||
$warnings
|
||||
));
|
||||
|
||||
$this->assertEquals(1, count($warnings->getValue($configValidator)));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue