function ConfigActionsTest::testConfigActions

Same name in this branch
  1. 11.x core/modules/language/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\language\Kernel\ConfigActionsTest::testConfigActions()
  2. 11.x core/modules/field/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\field\Kernel\ConfigActionsTest::testConfigActions()
  3. 11.x core/modules/contact/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\contact\Kernel\ConfigActionsTest::testConfigActions()
  4. 11.x core/modules/node/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\node\Kernel\ConfigActionsTest::testConfigActions()
  5. 11.x core/modules/image/tests/src/Kernel/ConfigActionsTest.php \Drupal\Tests\image\Kernel\ConfigActionsTest::testConfigActions()

File

core/modules/media/tests/src/Kernel/ConfigActionsTest.php, line 35

Class

ConfigActionsTest
@group media

Namespace

Drupal\Tests\media\Kernel

Code

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.