public function LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent in Lingotek Translation 8.2
Same name and namespace in other branches
- 4.0.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.0.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.1.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.2.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.3.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.4.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.5.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.6.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.7.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
- 3.8.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateOrphanContent()
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
- tests/
src/ Functional/ LingotekUtilitiesDisassociateAllDocumentsTest.php, line 315
Class
- LingotekUtilitiesDisassociateAllDocumentsTest
- Tests disassociating all site documents.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDisassociateOrphanContent() {
// We create manually the given data for setting up an incorrect status.
$metadata = LingotekContentMetadata::create();
$metadata
->setDocumentId('a_document_id');
$metadata
->setContentEntityTypeId('node');
$metadata
->setContentEntityId(1);
$metadata
->save();
// Let's try to disassociate then.
$this
->drupalGet('/admin/lingotek/settings');
$this
->drupalPostForm('admin/lingotek/settings', [], 'Disassociate');
$this
->assertRaw("Are you sure you want to disassociate everything from Lingotek?");
$this
->drupalPostForm(NULL, [], 'Disassociate');
$this
->assertText('All translations have been disassociated.');
// We create manually the given data for setting up an incorrect status.
$metadata = LingotekContentMetadata::create();
$metadata
->setDocumentId('a_document_id');
$metadata
->setContentEntityTypeId(NULL);
$metadata
->setContentEntityId(NULL);
$metadata
->save();
// Let's try to disassociate then.
$this
->drupalGet('/admin/lingotek/settings');
$this
->drupalPostForm('admin/lingotek/settings', [], 'Disassociate');
$this
->assertRaw("Are you sure you want to disassociate everything from Lingotek?");
$this
->drupalPostForm(NULL, [], 'Disassociate');
$this
->assertText('All translations have been disassociated.');
}