public function LingotekBulkDeleteTest::testTaxonomyTermBulkDelete in Lingotek Translation 8
Tests that a taxonomy term cannot be deleted in the management page.
File
- src/
Tests/ LingotekBulkDeleteTest.php, line 129
Class
- LingotekBulkDeleteTest
- Tests for bulk deletion in the bulk management page.
Namespace
Drupal\lingotek\TestsCode
public function testTaxonomyTermBulkDelete() {
$vocabulary = $this
->createVocabulary();
// Enable translation for the current entity type and ensure the change is
// picked up.
ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', $vocabulary
->id())
->setLanguageAlterable(TRUE)
->save();
\Drupal::service('content_translation.manager')
->setEnabled('taxonomy_term', $vocabulary
->id(), TRUE);
\Drupal::service('entity.definition_update_manager')
->applyUpdates();
// Rebuild the container so that the new languages are picked up by services
// that hold a list of languages.
$this
->rebuildContainer();
$bundle = $vocabulary
->id();
$edit = [
"taxonomy_term[{$bundle}][enabled]" => 1,
"taxonomy_term[{$bundle}][profiles]" => 'automatic',
"taxonomy_term[{$bundle}][fields][name]" => 1,
"taxonomy_term[{$bundle}][fields][description]" => 1,
];
$this
->drupalPostForm('admin/lingotek/settings', $edit, 'Save', [], [], 'lingoteksettings-tab-content-form');
$this
->goToContentBulkManagementForm('taxonomy_term');
// Ensure the delete operation is not there.
$delete_option = $this
->xpath('//*[@id="edit-operation"]/option[text()="Delete content"]');
$this
->assertIdentical(0, count($delete_option), 'Delete operation should not be available');
}