You are here

public function ConfigActionsSourceTest::testTemplate in Config Actions 8

@covers \Drupal\config_actions\Plugin\ConfigActionsSource\ConfigActionsId

File

tests/src/Kernel/ConfigActionsSourceTest.php, line 269

Class

ConfigActionsSourceTest
test the ConfigActionsSource plugins

Namespace

Drupal\Tests\config_actions\Kernel

Code

public function testTemplate() {
  $source = 'field.field.node.image';
  $options = [
    'source' => $source,
  ];

  /** @var \Drupal\config_actions\ConfigActionsSourceInterface $plugin */
  $plugin = $this->sourceManager
    ->createInstance('template', $options);
  $this
    ->assertFalse($plugin
    ->detect($source), 'No autodetection');
  $data = $plugin
    ->load();
  $this
    ->assertEquals('@field_name@', $data['field_name']);
  $this
    ->assertFalse($plugin
    ->save([]), 'Should not save');
}