function MigrateDefaultLanguageTest::setDefaultLanguage

Same name in this branch
  1. 10 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::setDefaultLanguage()
Same name in other branches
  1. 9 core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::setDefaultLanguage()
  2. 9 core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::setDefaultLanguage()
  3. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::setDefaultLanguage()
  4. 8.9.x core/modules/language/tests/src/Kernel/Migrate/d7/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d7\MigrateDefaultLanguageTest::setDefaultLanguage()
  5. 11.x core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php \Drupal\Tests\language\Kernel\Migrate\d6\MigrateDefaultLanguageTest::setDefaultLanguage()
  6. 11.x 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/d6/MigrateDefaultLanguageTest.php
Tests language_default migration with an existing language.
MigrateDefaultLanguageTest::testMigrationWithNonExistentLanguage in core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php
Tests language_default migration with a non-existing language.

File

core/modules/language/tests/src/Kernel/Migrate/d6/MigrateDefaultLanguageTest.php, line 80

Class

MigrateDefaultLanguageTest
Tests the default language variable migration.

Namespace

Drupal\Tests\language\Kernel\Migrate\d6

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();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.