You are here

LingotekLanguageContentSettingsFormTest.php in Lingotek Translation 3.6.x

File

tests/src/Functional/Form/LingotekLanguageContentSettingsFormTest.php
View source
<?php

namespace Drupal\Tests\lingotek\Functional\Form;

use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\language\Entity\ContentLanguageSettings;
use Drupal\Tests\lingotek\Functional\LingotekTestBase;

/**
 * Tests the Language Content Settings form alters.
 *
 * @group lingotek
 */
class LingotekLanguageContentSettingsFormTest extends LingotekTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'block',
    'node',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();

    // Create Article node types.
    $this
      ->drupalCreateContentType([
      'type' => 'article',
      'name' => 'Article',
    ]);

    // Add a language.
    ConfigurableLanguage::createFromLangcode('es')
      ->setThirdPartySetting('lingotek', 'locale', 'es_MX')
      ->save();

    // Enable translation for the current entity type and ensure the change is
    // picked up.
    ContentLanguageSettings::loadByEntityTypeBundle('node', 'article')
      ->setLanguageAlterable(TRUE)
      ->save();
    \Drupal::service('content_translation.manager')
      ->setEnabled('node', 'article', TRUE);
    drupal_static_reset();
    \Drupal::entityTypeManager()
      ->clearCachedDefinitions();
    $this
      ->applyEntityUpdates();

    // Rebuild the container so that the new languages are picked up by services
    // that hold a list of languages.
    $this
      ->rebuildContainer();
    $this
      ->saveLingotekContentTranslationSettingsForNodeTypes();
  }
  public function testLingotekMetadataFieldNotPresent() {
    $this
      ->drupalGet('admin/config/regional/content-language');
    $this
      ->assertNoText('Lingotek translation source');
    $this
      ->assertNoText('Lingotek metadata');
  }

}

Classes

Namesort descending Description
LingotekLanguageContentSettingsFormTest Tests the Language Content Settings form alters.