You are here

public function TokenCustomConfigSchemaTest::testTokenCustomConfigSchema in Custom Tokens 8

Tests the token_custom config schema for TokenCustomType plugins.

File

tests/src/Kernel/TokenCustomConfigSchemaTest.php, line 37

Class

TokenCustomConfigSchemaTest
Tests the token_custom config schema.

Namespace

Drupal\Tests\token_custom\Kernel

Code

public function testTokenCustomConfigSchema() {
  $id = 'my_token_type';
  $token_custom_type = TokenCustomType::create([
    'uuid' => '6a05119f-f3a0-43b6-bc03-070a67cb4529',
    'status' => 1,
    'dependencies' => [],
    'machineName' => $id,
    'name' => 'My Token Type',
    'description' => 'This is a custom token type for testing purposes.',
  ]);
  $token_custom_type
    ->save();
  $config = $this
    ->config("token_custom.type.{$id}");
  $this
    ->assertEqual($config
    ->get('machineName'), $id);
  $this
    ->assertConfigSchema($this->typedConfig, $config
    ->getName(), $config
    ->get());
}