You are here

public function LingotekBulkDeleteTest::testTaxonomyTermBulkDelete in Lingotek Translation 3.6.x

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  2. 4.0.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  3. 3.0.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  4. 3.1.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  5. 3.2.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  6. 3.3.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  7. 3.4.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  8. 3.5.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  9. 3.7.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()
  10. 3.8.x tests/src/Functional/LingotekBulkDeleteTest.php \Drupal\Tests\lingotek\Functional\LingotekBulkDeleteTest::testTaxonomyTermBulkDelete()

Tests that a taxonomy term cannot be deleted in the management page.

File

tests/src/Functional/LingotekBulkDeleteTest.php, line 123

Class

LingotekBulkDeleteTest
Tests for bulk deletion in the bulk management page.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testTaxonomyTermBulkDelete() {
  $assert_session = $this
    ->assertSession();
  $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);
  $this
    ->applyEntityUpdates();

  // 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');
}