function StringTranslationTraitTest::setUp
Same name in other branches
- 8.9.x core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::setUp()
- 10 core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::setUp()
- 11.x core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::setUp()
Overrides UnitTestCase::setUp
File
-
core/
tests/ Drupal/ Tests/ Core/ StringTranslation/ StringTranslationTraitTest.php, line 35
Class
- StringTranslationTraitTest
- @coversDefaultClass \Drupal\Core\StringTranslation\StringTranslationTrait @group StringTranslation
Namespace
Drupal\Tests\Core\StringTranslationCode
protected function setUp() : void {
$this->translation = $this->getObjectForTrait('\\Drupal\\Core\\StringTranslation\\StringTranslationTrait');
$mock = $this->prophesize(TranslationInterface::class);
$mock->translate(Argument::cetera())
->shouldNotBeCalled();
$mock->formatPlural(Argument::cetera())
->shouldNotBeCalled();
$mock->translateString(Argument::cetera())
->will(function ($args) {
return $args[0]->getUntranslatedString();
});
$this->translation
->setStringTranslation($mock->reveal());
$this->reflection = new \ReflectionClass(get_class($this->translation));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.