NodeorderConfigSchemaTest.php in Node Order 8
File
tests/src/Kernel/NodeorderConfigSchemaTest.php
View source
<?php
namespace Drupal\Tests\nodeorder\Kernel;
use Drupal\KernelTests\KernelTestBase;
use Drupal\Tests\SchemaCheckTestTrait;
class NodeorderConfigSchemaTest extends KernelTestBase {
use SchemaCheckTestTrait;
public static $modules = [
'system',
'nodeorder',
];
protected $typedConfig;
protected $configuration;
protected function setUp() {
parent::setUp();
$this->typedConfig = $this->container
->get('config.typed');
$this->configuration = $this->container
->get('config.nodeorder_settings');
}
public function testConfigSchema($data, $expected) {
$config = $this->configuration
->setData($data);
$actual = TRUE;
$message = NULL;
try {
$this
->assertConfigSchema($this->typedConfig, $config
->getName(), $config
->get());
} catch (\Throwable $exception) {
$actual = FALSE;
$message = $exception
->getMessage();
}
$this
->assertEquals($expected, $actual, $message);
}
public function configDataProvider() {
return [
[
[
'vocabularies' => [],
'override_taxonomy_page' => TRUE,
'show_links_on_node' => TRUE,
'link_to_ordering_page' => TRUE,
'link_to_ordering_page_taxonomy_admin' => TRUE,
],
TRUE,
],
[
[
'vocabularies' => new \stdClass(),
'override_taxonomy_page' => [],
'show_links_on_node' => 1,
'link_to_ordering_page' => 0,
'link_to_ordering_page_taxonomy_admin' => $this
->randomString(),
],
FALSE,
],
];
}
}