function TourValidationTest::providerInvalidMachineNameCharacters

Same name in other branches
  1. 11.x core/modules/tour/tests/src/Kernel/TourValidationTest.php \Drupal\Tests\tour\Kernel\TourValidationTest::providerInvalidMachineNameCharacters()

Tour IDs are atypical in that they allow dashes in the machine name.

Overrides ConfigEntityValidationTestBase::providerInvalidMachineNameCharacters

File

core/modules/tour/tests/src/Kernel/TourValidationTest.php, line 40

Class

TourValidationTest
Tests validation of tour entities.

Namespace

Drupal\Tests\tour\Kernel

Code

public static function providerInvalidMachineNameCharacters() : array {
    $cases = parent::providerInvalidMachineNameCharacters();
    // Remove the existing test case that verifies a machine name containing
    // periods is invalid.
    self::assertSame([
        'dash-separated',
        FALSE,
    ], $cases['INVALID: dash separated']);
    unset($cases['INVALID: dash separated']);
    // And instead add a test case that verifies it is allowed for tours.
    $cases['VALID: dash separated'] = [
        'dash-separated',
        TRUE,
    ];
    return $cases;
}

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