public function LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget in Lingotek Translation 3.4.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 4.0.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.0.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.1.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.2.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.3.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.5.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.6.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.7.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
- 3.8.x tests/src/Functional/LingotekContentTypeBulkCancelTest.php \Drupal\Tests\lingotek\Functional\LingotekContentTypeBulkCancelTest::testContentTypeCancelTarget()
Tests that a config entity target can be cancelled using the bulk operations on the management page.
File
- tests/
src/ Functional/ LingotekContentTypeBulkCancelTest.php, line 94
Class
- LingotekContentTypeBulkCancelTest
- Tests cancelling config entities using the bulk management form.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testContentTypeCancelTarget() {
$assert_session = $this
->assertSession();
// This is a hack for avoiding writing different lingotek endpoint mocks.
\Drupal::state()
->set('lingotek.uploaded_content_type', 'content_type');
// Login as admin.
$this
->drupalLogin($this->rootUser);
$this
->createAndTranslateContentTypeWithLinks();
// Mark the first for cancelling.
$edit = [
'table[article]' => 'article',
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForCancelTarget('es', 'node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
/** @var \Drupal\lingotek\LingotekConfigTranslationServiceInterface $config_translation_service */
$config_translation_service = \Drupal::service('lingotek.config_translation');
\Drupal::entityTypeManager()
->getStorage('node_type')
->resetCache();
// Assert that the document target has been cancelled remotely.
$cancelled_locales = \Drupal::state()
->get('lingotek.cancelled_locales', []);
$this
->assertTrue(isset($cancelled_locales['dummy-document-hash-id']) && in_array('es_ES', $cancelled_locales['dummy-document-hash-id']), 'The document target has been cancelled remotely.');
\Drupal::entityTypeManager()
->getStorage('node_type')
->resetCache();
$entity = \Drupal::entityTypeManager()
->getStorage('node_type')
->load('article');
$this
->assertEquals('dummy-document-hash-id', $config_translation_service
->getDocumentId($entity));
$this
->assertSourceStatus('EN', Lingotek::STATUS_CURRENT);
$this
->assertTargetStatus('ES', Lingotek::STATUS_CANCELLED);
$this
->assertIdentical(Lingotek::STATUS_CURRENT, $config_translation_service
->getSourceStatus($entity));
$this
->assertIdentical(Lingotek::STATUS_CANCELLED, $config_translation_service
->getTargetStatus($entity, 'es'));
// We cannot request again.
$basepath = \Drupal::request()
->getBasePath();
$assert_session
->linkByHrefNotExists($basepath . '/admin/lingotek/config/request/node_type/article/es_ES?destination=' . $basepath . '/admin/lingotek/config/manage');
}