From faf74150e9481ad9338eb6cc2428d02b24e9fc43 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Sun, 6 Oct 2019 21:03:20 +0200 Subject: Mailer: Use users locale for translation --- .../Translation/TranslationServiceProviderTest.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'tests/Unit/Helpers/Translation') diff --git a/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php b/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php index 91307bdd..1822f353 100644 --- a/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php +++ b/tests/Unit/Helpers/Translation/TranslationServiceProviderTest.php @@ -21,7 +21,7 @@ class TranslationServiceProviderTest extends ServiceProviderTest $locales = ['fo_OO' => 'Foo', 'fo_OO.BAR' => 'Foo (Bar)', 'te_ST.WTF-9' => 'WTF\'s Testing?']; $config = new Config(['locales' => $locales, 'default_locale' => $defaultLocale]); - $app = $this->getApp(['make', 'instance', 'get']); + $app = $this->getApp(['make', 'singleton', 'alias', 'get']); /** @var Session|MockObject $session */ $session = $this->createMock(Session::class); /** @var Translator|MockObject $translator */ @@ -60,12 +60,16 @@ class TranslationServiceProviderTest extends ServiceProviderTest ) ->willReturn($translator); - $app->expects($this->exactly(2)) - ->method('instance') - ->withConsecutive( - [Translator::class, $translator], - ['translator', $translator] - ); + $app->expects($this->once()) + ->method('singleton') + ->willReturnCallback(function (string $abstract, callable $callback) use ($translator) { + $this->assertEquals(Translator::class, $abstract); + $this->assertEquals($translator, $callback()); + }); + + $app->expects($this->once()) + ->method('alias') + ->with(Translator::class, 'translator'); $serviceProvider->register(); } -- cgit v1.2.3-70-g09d2