class LocaleTranslationTest

Same name in this branch
  1. 10 core/modules/locale/tests/src/Unit/LocaleTranslationTest.php \Drupal\Tests\locale\Unit\LocaleTranslationTest

@coversDefaultClass \Drupal\locale\LocaleTranslation
@group locale

Hierarchy

Expanded class hierarchy of LocaleTranslationTest

File

core/modules/locale/tests/src/Kernel/LocaleTranslationTest.php, line 14

Namespace

Drupal\Tests\locale\Kernel
View source
class LocaleTranslationTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'locale',
  ];
  
  /**
   * Tests that \Drupal\locale\LocaleTranslation is serializable.
   */
  public function testSerializable() : void {
    $translation = $this->container
      ->get('string_translator.locale.lookup');
    $this->assertInstanceOf(LocaleTranslation::class, $translation);
    // Prove that serialization and deserialization works without errors.
    $this->assertNotNull($translation);
    $unserialized = unserialize(serialize($translation));
    $this->assertInstanceOf(LocaleTranslation::class, $unserialized);
  }

}

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