public function LingotekConfigBulkFormTest::testClearJobIds in Lingotek Translation 3.2.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 4.0.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.0.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.1.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.3.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.4.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.5.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.6.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.7.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
- 3.8.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testClearJobIds()
Tests clearing job ids.
File
- tests/
src/ Functional/ Form/ LingotekConfigBulkFormTest.php, line 743
Class
- LingotekConfigBulkFormTest
- Tests the config bulk management form.
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testClearJobIds() {
$assert_session = $this
->assertSession();
$this
->goToConfigBulkManagementForm('node_type');
$basepath = \Drupal::request()
->getBasePath();
// I can init the upload of content.
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
$assert_session
->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/page?destination=' . $basepath . '/admin/lingotek/config/manage');
$this
->clickLink('EN');
$edit = [
'table[article]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForAssignJobId('node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$edit = [
'job_id' => 'my_custom_job_id_1',
'update_tms' => 1,
];
$this
->drupalPostForm(NULL, $edit, 'Assign Job ID');
$this
->assertText('Job ID was assigned successfully.');
$edit = [
'table[page]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForAssignJobId('node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$edit = [
'job_id' => 'my_custom_job_id_2',
'update_tms' => 1,
];
$this
->drupalPostForm(NULL, $edit, 'Assign Job ID');
$this
->assertText('Job ID was assigned successfully.');
// The job id is displayed.
$this
->assertText('my_custom_job_id_1');
$this
->assertText('my_custom_job_id_2');
$edit = [
'table[article]' => TRUE,
'table[page]' => TRUE,
$this
->getBulkOperationFormName() => $this
->getBulkOperationNameForClearJobId('node_type'),
];
$this
->drupalPostForm(NULL, $edit, $this
->getApplyActionsButtonLabel());
$this
->drupalPostForm(NULL, [], 'Clear Job ID');
$this
->assertText('Job ID was cleared successfully.');
// There is no upload.
\Drupal::state()
->resetCache();
$this
->assertEquals('my_custom_job_id_1', \Drupal::state()
->get('lingotek.uploaded_job_id'));
// The job id is gone.
$this
->assertNoText('my_custom_job_id_1');
$this
->assertNoText('my_custom_job_id_2');
}