public function LingotekUtilitiesDisassociateAllDocumentsTest::testDisassociateAllDocuments in Lingotek Translation 8
File
- src/Tests/LingotekUtilitiesDisassociateAllDocumentsTest.php, line 179
Class
- LingotekUtilitiesDisassociateAllDocumentsTest
- Tests disassociating all site documents.
Namespace
Drupal\lingotek\Tests
Code
public function testDisassociateAllDocuments() {
$this
->drupalGet('/admin/lingotek/settings');
$this
->drupalPostForm('admin/lingotek/settings', [], 'Disassociate');
$node = Node::load(1);
$term = Term::load(1);
$content_translation_service = \Drupal::service('lingotek.content_translation');
$config_translation_service = \Drupal::service('lingotek.config_translation');
$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));
$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));
$article_type = \Drupal::entityManager()
->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));
$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));
$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');
$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');
}