MetatagSettingsTest.php in Metatag 8
File
tests/src/Kernel/MetatagSettingsTest.php
View source
<?php
namespace Drupal\Tests\metatag\Kernel;
use Drupal\KernelTests\KernelTestBase;
class MetatagSettingsTest extends KernelTestBase {
protected static $modules = [
'token',
'metatag',
];
protected $metatagManager;
protected $configFactory;
protected function setUp() {
parent::setUp();
$this->metatagManager = $this->container
->get('metatag.manager');
$this->configFactory = $this->container
->get('config.factory');
$this
->installConfig([
'metatag',
]);
}
public function testMetatagSettings() {
$metatag_groups = $this->metatagManager
->sortedGroups();
$config = $this->configFactory
->getEditable('metatag.settings');
$group = reset($metatag_groups);
$group_id = $group['id'];
$value = [];
$value['user']['user'][$group_id] = $group_id;
$config
->set('entity_type_groups', $value)
->save();
$this
->assertSame($value, $config
->get('entity_type_groups'));
}
}