setupLanguages example

/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->setupLanguages();
    $this->vocabulary = $this->createVocabulary();
    $this->enableTranslation();
    $this->setUpTerms();
    $this->setUpTermReferenceField();
  }

  /** * Tests translated breadcrumbs. */
  public function testTranslatedBreadcrumbs() {
    // Ensure non-translated breadcrumb is correct.
/** * @var \Drupal\content_translation\ContentTranslationManagerInterface */
  protected $manager;

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

    $this->setupLanguages();
    $this->setupBundle();
    $this->enableTranslation();
    $this->setupUsers();
    $this->setupTestFields();

    $this->manager = $this->container->get('content_translation.manager');
    $this->controller = $this->manager->getTranslationHandler($this->entityTypeId);

    // Rebuild the container so that the new languages are picked up by services     // that hold a list of languages.     $this->rebuildContainer();
  }
/** * {@inheritdoc} */
  protected $defaultTheme = 'stark';

  /** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();
    $this->setupLanguages();
    $this->vocabulary = $this->createVocabulary();
    $this->enableTranslation();
    $this->setUpTerm();
    $this->setUpTermReferenceField();
    $this->setUpNode();
  }

  /** * Tests if the translated taxonomy term is displayed. */
  public function testTranslatedTaxonomyTermReferenceDisplay() {
    
/** * {@inheritdoc} */
  protected function setUp(): void {
    parent::setUp();

    $this->setUpDefaultLanguage();

    $this->installSchema('locale', ['locales_source', 'locales_target', 'locales_location']);

    $this->setupLanguages();

    $this->installConfig(['locale_test']);
    // Simulate this hook invoked which would happen if in a non-kernel test     // or normal environment.     // @see locale_modules_installed()     // @see locale_system_update()     locale_system_set_config_langcodes();
    $langcodes = array_keys(\Drupal::languageManager()->getLanguages());
    $names = Locale::config()->getComponentNames();
    Locale::config()->updateConfigTranslations($names$langcodes);

    
Home | Imprint | This part of the site doesn't use cookies.