You are here

public function LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent in Lingotek Translation 8

Tests that we can disassociate orphan content.

This should never be an allowed status, but let's ensure that we fail gracefully. If a corresponding node doesn't exist anymore, we should just remove the existing metadata.

File

src/Tests/LingotekUtilitiesDisassociateAllDocumentsTest.php, line 232

Class

LingotekUtilitiesDisassociateAllDocumentsTest
Tests disassociating all site documents.

Namespace

Drupal\lingotek\Tests

Code

public function testDisassociateOrphanContent() {

  // We create manually the given data for setting up an incorrect status.
  \Drupal::database()
    ->insert('lingotek_content_metadata')
    ->fields([
    'document_id',
    'entity_type',
    'entity_id',
  ])
    ->values([
    'document_id' => 'a_document_id',
    'entity_type' => 'node',
    'entity_id' => 1,
  ])
    ->execute();

  // Let's try to disassociate then.
  $this
    ->drupalGet('/admin/lingotek/settings');
  $this
    ->drupalPostForm('admin/lingotek/settings', [], 'Disassociate');
}