You are here

protected function MigrateDefaultLanguageTest::setDefaultLanguage in Drupal 10

Same name in this branch
  1. 10 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::setDefaultLanguage()
  2. 10 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::setDefaultLanguage()
Same name and namespace in other branches
  1. 8 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::setDefaultLanguage()
  2. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::setDefaultLanguage()

Helper method to test the migration.

Parameters

string $langcode: The langcode of the default language.

2 calls to MigrateDefaultLanguageTest::setDefaultLanguage()
MigrateDefaultLanguageTest::testMigrationWithExistingLanguage in core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php
Tests language_default migration with a non-existing language.
MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage in core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php
Tests language_default migration with a non-existing language.

File

core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php, line 78

Class

MigrateDefaultLanguageTest
Tests the default language variable migration.

Namespace

Drupal\Tests\language\Kernel\Migrate\d7

Code

protected function setDefaultLanguage($langcode) {

  // The default language of the test fixture is English. Change it to
  // something else before migrating, to be sure that the source site
  // default language is migrated.
  $value = 'O:8:"stdClass":11:{s:8:"language";s:2:"' . $langcode . '";s:4:"name";s:6:"French";s:6:"native";s:6:"French";s:9:"direction";s:1:"0";s:7:"enabled";i:1;s:7:"plurals";s:1:"0";s:7:"formula";s:0:"";s:6:"domain";s:0:"";s:6:"prefix";s:0:"";s:6:"weight";s:1:"0";s:10:"javascript";s:0:"";}';
  $this->sourceDatabase
    ->update('variable')
    ->fields([
    'value' => $value,
  ])
    ->condition('name', 'language_default')
    ->execute();
}