setUpConfigEntityType example


  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());
  }

  /** * Tests when the prefix length is valid. * * Tests that a valid config prefix returned by getConfigPrefix() * does not throw an exception and is formatted as expected. * * @covers ::getConfigPrefix */
Home | Imprint | This part of the site doesn't use cookies.