You are here

public function ConfigEntityTypeTest::testConfigPrefixLengthValid in Drupal 8

Same name and namespace in other branches
  1. 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityTypeTest::testConfigPrefixLengthValid()
  2. 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityTypeTest::testConfigPrefixLengthValid()

Tests that a valid config prefix returned by getConfigPrefix() does not throw an exception and is formatted as expected.

@covers ::getConfigPrefix

File

core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php, line 76

Class

ConfigEntityTypeTest
@coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityType @group Config

Namespace

Drupal\Tests\Core\Config\Entity

Code

public function testConfigPrefixLengthValid() {

  // A provider length of 24 and config_prefix length of 58 (+1 for the .)
  // results in a config length of 83, which is right at the limit.
  $definition = [
    'provider' => $this
      ->randomMachineName(24),
    'config_prefix' => $this
      ->randomMachineName(58),
  ];
  $config_entity = $this
    ->setUpConfigEntityType($definition);
  $expected_prefix = $definition['provider'] . '.' . $definition['config_prefix'];
  $this
    ->assertEquals($expected_prefix, $config_entity
    ->getConfigPrefix());
}