*/ namespace yiiunit\extensions\bootstrap5; use yii\bootstrap5\Alert; use yii\bootstrap5\Breadcrumbs; class TranslationTest extends TestCase { protected function setUp(): void { $this->mockWebApplication([ 'language' => 'de-CH', 'sourceLanguage' => 'en-US', 'components' => [ 'i18n' => [ 'translations' => [ 'yii/bootstrap5*' => [ 'class' => 'yii\i18n\GettextMessageSource', 'sourceLanguage' => 'en-US', 'basePath' => '@yii/bootstrap5/messages', ], ], ], ], ]); } public function testTranslatedAlert() { Alert::$counter = 0; $html = Alert::widget([ 'body' => 'Heilige Guacamole! Das ist ein deutscher Test.', 'options' => [ 'class' => ['alert-warning'] ] ]); $expectedHtml = << Heilige Guacamole! Das ist ein deutscher Test. HTML; $this->assertEqualsWithoutLE($expectedHtml, $html); } public function testTranslatedBreadcrumb() { Breadcrumbs::$counter = 0; $out = Breadcrumbs::widget([ 'links' => [ ['label' => 'Library', 'url' => '#'], ['label' => 'Data'] ] ]); $expected = <<