You are here

public function MissingFieldsTest::testMissingFieldsImport in Entity Share 8.3

Test that import does not fail when client does not have ome server fields.

File

modules/entity_share_client/tests/src/Functional/MissingFieldsTest.php, line 108

Class

MissingFieldsTest
Functional test class for non-existing fields on client website.

Namespace

Drupal\Tests\entity_share_client\Functional

Code

public function testMissingFieldsImport() {

  // Test node with entity reference.
  $this
    ->pullChannel('node_es_test_en');
  $this->importService
    ->getRuntimeImportContext()
    ->clearImportedEntities();

  /** @var \Drupal\node\NodeInterface $node */
  $node = $this
    ->loadEntity('node', 'es_test_missing_fields');
  $this
    ->assertTrue($node instanceof NodeInterface, 'The node had been imported');

  // Test new translation.
  $this
    ->pullChannel('node_es_test_fr');
  $this->importService
    ->getRuntimeImportContext()
    ->clearImportedEntities();
  $node = $this
    ->loadEntity('node', 'es_test_missing_fields');
  $node_translation = $node
    ->getTranslation('fr');
  $this
    ->assertFalse($node_translation
    ->isDefaultTranslation(), 'The French translation had been created.');

  // Test translation update.
  $this
    ->pullChannel('node_es_test_fr');
  $node = $this
    ->loadEntity('node', 'es_test_missing_fields');
  $node_translation = $node
    ->getTranslation('fr');
  $this
    ->assertFalse($node_translation
    ->isDefaultTranslation(), 'The French translation had been updated.');
}