public function ConfigActionsSourceTest::testId in Config Actions 8
@covers \Drupal\config_actions\Plugin\ConfigActionsSource\ConfigActionsId
File
- tests/
src/ Kernel/ ConfigActionsSourceTest.php, line 111
Class
- ConfigActionsSourceTest
- test the ConfigActionsSource plugins
Namespace
Drupal\Tests\config_actions\KernelCode
public function testId() {
$source = 'core.date_format.long';
$options = [
'source' => $source,
];
/** @var \Drupal\config_actions\ConfigActionsSourceInterface $plugin */
$plugin = $this->sourceManager
->createInstance('id', $options);
$this
->assertTrue($plugin
->detect($source), 'Source detected');
$data = $plugin
->load();
$this
->assertEquals('long', $data['id']);
$new_data = [
'label' => "My Label",
];
$plugin
->setMerge(TRUE);
$this
->assertTrue($plugin
->save($new_data), 'Saving data to plugin');
$data = $plugin
->load();
$this
->assertEquals('My Label', $data['label']);
}