public function LingotekConfigBulkFormTest::testDisabledLanguage in Lingotek Translation 3.6.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 4.0.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.0.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.1.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.2.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.3.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.4.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.5.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.7.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 - 3.8.x tests/src/Functional/Form/LingotekConfigBulkFormTest.php \Drupal\Tests\lingotek\Functional\Form\LingotekConfigBulkFormTest::testDisabledLanguage()
 
Tests that the config bulk form doesn't show a language if it's disabled.
File
- tests/
src/ Functional/ Form/ LingotekConfigBulkFormTest.php, line 105  
Class
- LingotekConfigBulkFormTest
 - Tests the config bulk management form.
 
Namespace
Drupal\Tests\lingotek\Functional\FormCode
public function testDisabledLanguage() {
  $assert_session = $this
    ->assertSession();
  // Go and upload a field.
  $this
    ->goToConfigBulkManagementForm('node_type');
  $basepath = \Drupal::request()
    ->getBasePath();
  // Clicking English must init the upload of content.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
  // And we cannot request yet a translation.
  $this
    ->assertNoLingotekRequestTranslationLink('es_MX');
  $this
    ->clickLink('EN');
  // There is a link for checking status.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/check_upload/node_type/article?destination=' . $basepath . '/admin/lingotek/config/manage');
  // And we can already request a translation.
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  // Then we disable the Spanish language.
  /** @var \Drupal\lingotek\LingotekConfigurationServiceInterface $lingotekConfig */
  $lingotekConfig = \Drupal::service('lingotek.configuration');
  $language = ConfigurableLanguage::load('es');
  $lingotekConfig
    ->disableLanguage($language);
  // And we check that Spanish is not there anymore.
  $this
    ->goToConfigBulkManagementForm();
  $assert_session
    ->linkByHrefNotExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
  // We re-enable Spanish.
  $lingotekConfig
    ->enableLanguage($language);
  // And Spanish should be back in the management form.
  $this
    ->goToConfigBulkManagementForm();
  $assert_session
    ->linkByHrefExists($basepath . '/admin/lingotek/config/request/node_type/article/es_MX?destination=' . $basepath . '/admin/lingotek/config/manage');
}