class TestTranslationManager

Same name in this branch
  1. 10 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
Same name in other branches
  1. 9 core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\TestTranslationManager
  2. 9 core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
  3. 8.9.x core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\TestTranslationManager
  4. 8.9.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager
  5. 11.x core/modules/user/tests/src/Unit/PermissionHandlerTest.php \Drupal\Tests\user\Unit\TestTranslationManager
  6. 11.x core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php \Drupal\Tests\Core\StringTranslation\TestTranslationManager

Implements a translation manager in tests.

Hierarchy

  • class \Drupal\Tests\user\Unit\TestTranslationManager implements \Drupal\Core\StringTranslation\TranslationInterface

Expanded class hierarchy of TestTranslationManager

File

core/modules/user/tests/src/Unit/PermissionHandlerTest.php, line 385

Namespace

Drupal\Tests\user\Unit
View source
class TestTranslationManager implements TranslationInterface {
    
    /**
     * {@inheritdoc}
     */
    public function translate($string, array $args = [], array $options = []) {
        return new TranslatableMarkup($string, $args, $options, $this);
    }
    
    /**
     * {@inheritdoc}
     */
    public function translateString(TranslatableMarkup $translated_string) {
        return $translated_string->getUntranslatedString();
    }
    
    /**
     * {@inheritdoc}
     */
    public function formatPlural($count, $singular, $plural, array $args = [], array $options = []) {
        return new PluralTranslatableMarkup($count, $singular, $plural, $args, $options, $this);
    }

}

Members


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