TokenCustomConfigSchemaTest.php in Custom Tokens 8
File
tests/src/Kernel/TokenCustomConfigSchemaTest.php
View source
<?php
namespace Drupal\Tests\token_custom\Kernel;
use Drupal\token_custom\Entity\TokenCustomType;
use Drupal\Tests\SchemaCheckTestTrait;
use Drupal\KernelTests\KernelTestBase;
class TokenCustomConfigSchemaTest extends KernelTestBase {
use SchemaCheckTestTrait;
public static $modules = [
'token_custom',
];
protected function setUp() {
parent::setUp();
$this->typedConfig = \Drupal::service('config.typed');
}
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());
}
}