function ConfigEntityTypeTest::testConfigPrefixLengthExceeds
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityTypeTest::testConfigPrefixLengthExceeds()
- 10 core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityTypeTest::testConfigPrefixLengthExceeds()
- 11.x core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityTypeTest.php \Drupal\Tests\Core\Config\Entity\ConfigEntityTypeTest::testConfigPrefixLengthExceeds()
Tests that we get an exception when the length of the config prefix that is returned by getConfigPrefix() exceeds the maximum defined prefix length.
@covers ::getConfigPrefix
File
-
core/
tests/ Drupal/ Tests/ Core/ Config/ Entity/ ConfigEntityTypeTest.php, line 57
Class
- ConfigEntityTypeTest
- @coversDefaultClass \Drupal\Core\Config\Entity\ConfigEntityType @group Config
Namespace
Drupal\Tests\Core\Config\EntityCode
public function testConfigPrefixLengthExceeds() {
// A provider length of 24 and config_prefix length of 59 (+1 for the .)
// results in a config length of 84, which is too long.
$definition = [
'provider' => $this->randomMachineName(24),
'config_prefix' => $this->randomMachineName(59),
];
$config_entity = $this->setUpConfigEntityType($definition);
$this->expectException('\\Drupal\\Core\\Config\\ConfigPrefixLengthException');
$this->expectExceptionMessage("The configuration file name prefix {$definition['provider']}.{$definition['config_prefix']} exceeds the maximum character limit of " . ConfigEntityType::PREFIX_LENGTH);
$this->assertEmpty($config_entity->getConfigPrefix());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.