From b443b53919f50bd0176e7b67dfd1efc28276a770 Mon Sep 17 00:00:00 2001 From: Igor Scheller Date: Thu, 18 Oct 2018 23:34:18 +0200 Subject: Translation: added pluralization support --- tests/Unit/HelpersTest.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests/Unit/HelpersTest.php') diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php index b9cedd30..b36abc64 100644 --- a/tests/Unit/HelpersTest.php +++ b/tests/Unit/HelpersTest.php @@ -218,6 +218,26 @@ class HelpersTest extends TestCase $this->assertEquals('Lorem foo Ipsum', __('Lorem %s Ipsum', ['foo'])); } + /** + * @covers \_e + */ + public function testTranslatePlural() + { + /** @var Translator|MockObject $translator */ + $translator = $this->getMockBuilder(Translator::class) + ->disableOriginalConstructor() + ->getMock(); + + $this->getAppMock('translator', $translator); + + $translator->expects($this->once()) + ->method('translatePlural') + ->with('One: %u', 'Multiple: %u', 4, [4]) + ->willReturn('Multiple: 4'); + + $this->assertEquals('Multiple: 4', _e('One: %u', 'Multiple: %u', 4, [4])); + } + /** * @covers \url */ -- cgit v1.2.3-54-g00ecf