You are here

public function ReplicationSettingsTest::testCreation in Replication 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/ReplicationSettingsTest.php \Drupal\Tests\replication\Kernel\ReplicationSettingsTest::testCreation()

Test creation of ReplicationSettings config entity.

File

tests/src/Kernel/ReplicationSettingsTest.php, line 33

Class

ReplicationSettingsTest
Test operations on ReplicationSettings config entity.

Namespace

Drupal\Tests\replication\Kernel

Code

public function testCreation() {
  $this
    ->installEntitySchema('replication_settings');
  $entityTypeManager = $this->container
    ->get('entity_type.manager');
  $entity = $entityTypeManager
    ->getStorage('replication_settings')
    ->create([
    'id' => 'test',
    'label' => 'Replication settings test',
    'filter_id' => 'entity_type',
    'parameters' => [
      'entity_type_id' => 'node',
      'bundle' => 'article',
    ],
  ]);
  $entity
    ->save();
  $entity = $entityTypeManager
    ->getStorage('replication_settings')
    ->load('test');
  $this
    ->assertEquals($entity
    ->id(), 'test', 'Test replication settings config entity successfully saved.');
}