class ComposerValidatorHelpTest
Tests Composer Validator.
@internal
Attributes
#[Group('package_manager')]
#[CoversClass(ComposerValidator::class)]
#[RunTestsInSeparateProcesses]
Hierarchy
- class \Drupal\KernelTests\KernelTestBase implements \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\Tests\DrupalTestCaseTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Prophecy\PhpUnit\ProphecyTrait, \Drupal\Tests\BrowserHtmlDebugTrait, \Drupal\Tests\HttpKernelUiHelperTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase uses \Drupal\Tests\package_manager\Traits\AssertPreconditionsTrait, \Drupal\Tests\package_manager\Traits\ComposerStagerTestTrait, \Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait, \Drupal\Tests\package_manager\Traits\FixtureUtilityTrait, \Drupal\package_manager\StatusCheckTrait, \Drupal\Tests\package_manager\Traits\ValidationTestTrait extends \Drupal\KernelTests\KernelTestBase
- class \Drupal\Tests\package_manager\Kernel\ComposerValidatorHelpTest uses \Drupal\Core\StringTranslation\StringTranslationTrait extends \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase
- class \Drupal\Tests\package_manager\Kernel\PackageManagerKernelTestBase uses \Drupal\Tests\package_manager\Traits\AssertPreconditionsTrait, \Drupal\Tests\package_manager\Traits\ComposerStagerTestTrait, \Drupal\Tests\package_manager\Traits\FixtureManipulatorTrait, \Drupal\Tests\package_manager\Traits\FixtureUtilityTrait, \Drupal\package_manager\StatusCheckTrait, \Drupal\Tests\package_manager\Traits\ValidationTestTrait extends \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of ComposerValidatorHelpTest
File
-
core/
modules/ package_manager/ tests/ src/ Kernel/ ComposerValidatorHelpTest.php, line 21
Namespace
Drupal\Tests\package_manager\KernelView source
class ComposerValidatorHelpTest extends PackageManagerKernelTestBase {
use StringTranslationTrait;
/**
* Data provider for ::testLinkToOnlineHelp().
*
* @return array[]
* The test cases.
*/
public static function providerLinkToOnlineHelp() : array {
return [
'TLS disabled' => [
[
'disable-tls' => TRUE,
],
[
t('TLS must be enabled for HTTPS Composer downloads. See <a href="/admin/help/package_manager#package-manager-requirements">the help page</a> for more information on how to configure Composer to download packages securely.'),
t('You should also check the value of <code>secure-http</code> and make sure that it is set to <code>true</code> or not set at all.'),
],
],
'secure-http is off' => [
[
'secure-http' => FALSE,
],
[
t('HTTPS must be enabled for Composer downloads. See <a href="/admin/help/package_manager#package-manager-requirements">the help page</a> for more information on how to configure Composer to download packages securely.'),
],
],
];
}
/**
* Tests that invalid configuration links to online help, if available.
*
* @param array $config
* The Composer configuration to set.
* @param \Drupal\Core\StringTranslation\TranslatableMarkup[] $expected_messages
* The expected validation error messages.
*/
public function testLinkToOnlineHelp(array $config, array $expected_messages) : void {
$this->enableModules([
'help',
]);
(new ActiveFixtureManipulator())->addConfig($config)
->commitChanges();
$result = ValidationResult::createError($expected_messages, $this->t("Composer settings don't satisfy Package Manager's requirements."));
$this->assertStatusCheckResults([
$result,
]);
}
/**
* {@inheritdoc}
*/
protected function tearDown() : void {
// Ensure that any warnings arising from Composer settings (which we expect
// in this test) will not fail the test during tear-down.
$this->failureLogger
->reset();
parent::tearDown();
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.