public function LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments in Lingotek Translation 3.0.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 4.0.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.1.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.2.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.3.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.4.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.5.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.6.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.7.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
- 3.8.x tests/src/Functional/LingotekUtilitiesDisassociateAllDocumentsTest.php \Drupal\Tests\lingotek\Functional\LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments()
File
- tests/
src/ Functional/ LingotekUtilitiesDisassociateAllDocumentsTest.php, line 184
Class
- LingotekUtilitiesDisassociateAllDocumentsTest
- Tests disassociating all site documents.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testDisassociateAllDocuments() {
$this
->drupalGet('/admin/lingotek/settings');
$this
->drupalPostForm(NULL, [], 'Disassociate');
$this
->assertRaw("Are you sure you want to disassociate everything from Lingotek?");
$this
->drupalPostForm(NULL, [], 'Disassociate');
$this
->assertText('All translations have been disassociated.');
$node = Node::load(1);
$term = Term::load(1);
/** @var \Drupal\lingotek\LingotekContentTranslationServiceInterface $content_translation_service */
$content_translation_service = \Drupal::service('lingotek.content_translation');
/** @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface $config_translation_service */
$config_translation_service = \Drupal::service('lingotek.config_translation');
// Ensure we have disassociated the node.
$this
->assertNull($content_translation_service
->getDocumentId($node), 'The node has been disassociated from its Lingotek Document ID');
$this
->assertIdentical(Lingotek::STATUS_UNTRACKED, $content_translation_service
->getSourceStatus($node));
// Ensure we have disassociated the term.
$this
->assertNull($content_translation_service
->getDocumentId($term), 'The term has been disassociated from its Lingotek Document ID');
$this
->assertIdentical(Lingotek::STATUS_UNTRACKED, $content_translation_service
->getSourceStatus($term));
// Ensure we are disassociated the article type.
$article_type = \Drupal::entityTypeManager()
->getStorage('node_type')
->load('article');
$this
->assertNull($config_translation_service
->getDocumentId($article_type), 'The article node type has been disassociated from its Lingotek Document ID');
$this
->assertIdentical(Lingotek::STATUS_UNTRACKED, $config_translation_service
->getSourceStatus($article_type));
// Ensure we are disassociated the config system.site.
$mappers = \Drupal::service('plugin.manager.config_translation.mapper')
->getMappers();
$mapper = $mappers['system.site_information_settings'];
$this
->assertNull($config_translation_service
->getConfigDocumentId($mapper), 'The system.site config mapper has been disassociated from its Lingotek Document ID');
$this
->assertIdentical(Lingotek::STATUS_UNTRACKED, $config_translation_service
->getConfigSourceStatus($mapper));
// Ensure the UIs show the right statuses.
$this
->goToContentBulkManagementForm('node');
$this
->assertSourceStatusStateCount(Lingotek::STATUS_UNTRACKED, 'EN', 1, 'The node shows as untracked');
$this
->goToContentBulkManagementForm('taxonomy_term');
$this
->assertSourceStatusStateCount(Lingotek::STATUS_UNTRACKED, 'EN', 1, 'The taxonomy term shows as untracked');
$this
->goToConfigBulkManagementForm('config');
// We have 4 configuration objects.
$this
->assertSourceStatusStateCount(Lingotek::STATUS_UNTRACKED, 'EN', 4, 'The configuration shows as untracked');
$this
->goToConfigBulkManagementForm('node_type');
$this
->assertSourceStatusStateCount(Lingotek::STATUS_UNTRACKED, 'EN', 1, 'The article type shows as untracked');
}