function ComposerValidatorTest::providerComposerSettingsValidation

Data provider for testComposerSettingsValidation().

Return value

mixed[][] The test cases.

File

core/modules/package_manager/tests/src/Kernel/ComposerValidatorTest.php, line 28

Class

ComposerValidatorTest
@covers \Drupal\package_manager\Validator\ComposerValidator[[api-linebreak]] @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public static function providerComposerSettingsValidation() : array {
  $summary = t("Composer settings don't satisfy Package Manager's requirements.");
  $secure_http_error = ValidationResult::createError([
    t('HTTPS must be enabled for Composer downloads. See <a href="https://getcomposer.org/doc/06-config.md#secure-http">the Composer documentation</a> for more information.'),
  ], $summary);
  $tls_error = ValidationResult::createError([
    t('TLS must be enabled for HTTPS Composer downloads. See <a href="https://getcomposer.org/doc/06-config.md#disable-tls">the Composer documentation</a> for more information.'),
    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.'),
  ], $summary);
  return [
    'secure-http set to FALSE' => [
      [
        'secure-http' => FALSE,
      ],
      [
        $secure_http_error,
      ],
    ],
    'secure-http explicitly set to TRUE' => [
      [
        'secure-http' => TRUE,
      ],
      [],
    ],
    'secure-http implicitly set to TRUE' => [
      [
        'extra.unrelated' => TRUE,
      ],
      [],
    ],
    'disable-tls set to TRUE' => [
      [
        'disable-tls' => TRUE,
      ],
      [
        $tls_error,
      ],
    ],
    'disable-tls implicitly set to FALSE' => [
      [
        'extra.unrelated' => TRUE,
      ],
      [],
    ],
    'explicitly set disable-tls to FALSE' => [
      [
        'disable-tls' => FALSE,
      ],
      [],
    ],
    'disable-tls set to TRUE + secure-http set to TRUE, message only for TLS, secure-http overridden' => [
      [
        'disable-tls' => TRUE,
        'secure-http' => TRUE,
      ],
      [
        $tls_error,
      ],
    ],
    'disable-tls set to TRUE + secure-http set to FALSE, message only for TLS' => [
      [
        'disable-tls' => TRUE,
        'secure-http' => FALSE,
      ],
      [
        $tls_error,
      ],
    ],
  ];
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.