protected function StringTranslationTraitTest::setUp in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/StringTranslation/StringTranslationTraitTest.php \Drupal\Tests\Core\StringTranslation\StringTranslationTraitTest::setUp()
- 9 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));
}