blob: 1a9474ed3ae123fd081b5733b0e72bbcce87be8b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
<?php
declare(strict_types=1);
namespace Drupal\Tests\language\Kernel;
use Drupal\Core\Config\Action\ConfigActionManager;
use Drupal\KernelTests\KernelTestBase;
use Drupal\language\Entity\ConfigurableLanguage;
/**
* @group language
*/
class ConfigActionsTest extends KernelTestBase {
/**
* {@inheritdoc}
*/
protected static $modules = ['language'];
/**
* The configuration action manager.
*/
private readonly ConfigActionManager $configActionManager;
/**
* {@inheritdoc}
*/
protected function setUp(): void {
parent::setUp();
$this->installConfig('language');
$this->configActionManager = $this->container->get('plugin.manager.config_action');
}
/**
* Tests the application of configuration actions on a language.
*/
public function testConfigActions(): void {
$language = ConfigurableLanguage::load('en');
$this->assertSame('English', $language->getName());
$this->assertSame(0, $language->getWeight());
$this->configActionManager->applyAction(
'entity_method:language.entity:setName',
$language->getConfigDependencyName(),
'Wacky language',
);
$this->configActionManager->applyAction(
'entity_method:language.entity:setWeight',
$language->getConfigDependencyName(),
39,
);
$language = ConfigurableLanguage::load('en');
$this->assertSame('Wacky language', $language->getName());
$this->assertSame(39, $language->getWeight());
}
}
|