function BlockValidationTest::providerInvalidMachineNameCharacters

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

Block names are atypical in that they allow periods in the machine name.

Overrides ConfigEntityValidationTestBase::providerInvalidMachineNameCharacters

File

core/modules/block/tests/src/Kernel/BlockValidationTest.php, line 61

Class

BlockValidationTest
Tests validation of block entities.

Namespace

Drupal\Tests\block\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([
        'period.separated',
        FALSE,
    ], $cases['INVALID: period separated']);
    unset($cases['INVALID: period separated']);
    // And instead add a test case that verifies it is allowed for blocks.
    $cases['VALID: period separated'] = [
        'period.separated',
        TRUE,
    ];
    return $cases;
}

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