You are here

public function LingotekConfigEntityBulkProfileTest::testChangeTranslationProfileBulk in Lingotek Translation 3.4.x

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

Tests that the translation profiles can be updated with the bulk actions.

File

tests/src/Functional/LingotekConfigEntityBulkProfileTest.php, line 49

Class

LingotekConfigEntityBulkProfileTest
Tests changing a profile using the bulk management form.

Namespace

Drupal\Tests\lingotek\Functional

Code

public function testChangeTranslationProfileBulk() {

  // This is a hack for avoiding writing different lingotek endpoint mocks.
  \Drupal::state()
    ->set('lingotek.uploaded_content_type', 'system.site');

  // Login as admin.
  $this
    ->drupalLogin($this->rootUser);

  // Go to the bulk config management page.
  $this
    ->goToConfigBulkManagementForm('node_type');
  $basepath = \Drupal::request()
    ->getBasePath();
  $edit = [
    'table[article]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'change_profile:automatic',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check that there are three nodes with the Automatic Profile
  $automatic_profile = $this
    ->xpath("//td[contains(text(), 'Automatic')]");
  $this
    ->assertEqual(count($automatic_profile), 1, 'Automatic Profile set');
  $edit = [
    'table[article]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'change_profile:manual',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check that there is one node with the Manual Profile
  // Check that there are two nodes with the Automatic Profile
  $manual_profile = $this
    ->xpath("//td[contains(text(), 'Manual')]");
  $this
    ->assertEqual(count($manual_profile), 1, 'Manual Profile set');
  $edit = [
    'table[article]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'change_profile:disabled',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check that there are three nodes with the Disabled Profile
  $disabled_profile = $this
    ->xpath("//td[contains(text(), 'Disabled')]");
  $this
    ->assertEqual(count($disabled_profile), 1, 'Disabled Profile set');
  $edit = [
    'table[article]' => TRUE,
    $this
      ->getBulkOperationFormName() => 'change_profile:automatic',
  ];
  $this
    ->drupalPostForm(NULL, $edit, $this
    ->getApplyActionsButtonLabel());

  // Check that there are three nodes with the Automatic Profile
  $automatic_profile = $this
    ->xpath("//td[contains(text(), 'Automatic')]");
  $this
    ->assertEqual(count($automatic_profile), 1, 'Automatic Profile set');
}