1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-08 16:17:37 +00:00
composer/tests/Composer/Test/Util/ConfigValidatorTest.php
Gabriel Caruso 2a13bb2649 Fixes from PHPStan (#7687)
* fix docblocks

* remove redundant conditional

* fix wrong variable name

* fix wrong namespaces

* add missing private members

* remove unused/redundant arguments

* move testcase class

* exclude TestCase.php

* Tweak RuleWatchGraph type hints

* Tweak doc comment
2018-11-12 15:23:32 +01:00

48 lines
1.4 KiB
PHP

<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Util;
use Composer\IO\NullIO;
use Composer\Util\ConfigValidator;
use Composer\Test\TestCase;
/**
* ConfigValidator test case
*/
class ConfigValidatorTest extends TestCase
{
/**
* Test ConfigValidator warns on commit reference
*/
public function testConfigValidatorCommitRefWarning()
{
$configValidator = new ConfigValidator(new NullIO());
list(, , $warnings) = $configValidator->validate(__DIR__ . '/Fixtures/composer_commit-ref.json');
$this->assertContains(
'The package "some/package" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
$warnings
);
}
public function testConfigValidatorWarnsOnScriptDescriptionForNonexistentScript()
{
$configValidator = new ConfigValidator(new NullIO());
list(, , $warnings) = $configValidator->validate(__DIR__ . '/Fixtures/composer_scripts-descriptions.json');
$this->assertContains(
'Description for non-existent script "phpcsxxx" found in "scripts-descriptions"',
$warnings
);
}
}