function ConfigActionsTest::testConfigActions
Tests the application of configuration actions on a media type.
File
-
core/
modules/ media/ tests/ src/ Kernel/ ConfigActionsTest.php, line 45
Class
- ConfigActionsTest
- Tests Config Actions.
Namespace
Drupal\Tests\media\KernelCode
public function testConfigActions() : void {
$media_type = MediaType::load('test');
$this->assertSame('Test type.', $media_type->getDescription());
$this->assertSame([
'metadata_attribute' => 'field_attribute_config_test',
], $media_type->getFieldMap());
$this->configActionManager
->applyAction('entity_method:media.type:setDescription', $media_type->getConfigDependencyName(), 'Changed by a config action...');
$this->configActionManager
->applyAction('entity_method:media.type:setFieldMap', $media_type->getConfigDependencyName(), [
'foo' => 'baz',
]);
$media_type = MediaType::load('test');
$this->assertSame('Changed by a config action...', $media_type->getDescription());
$this->assertSame([
'foo' => 'baz',
], $media_type->getFieldMap());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.