Passed
Pull Request — master (#416)
by Sergei
04:39 queued 01:56
created

ConfigTest::testSimpleMessageFormatter()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 6
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 11
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Validator\Tests\TestEnvironments\WithoutIntl;
6
7
use Yiisoft\Translator\CategorySource;
8
use Yiisoft\Translator\SimpleMessageFormatter;
9
use Yiisoft\Validator\Tests\BaseConfigTest;
10
11
final class ConfigTest extends BaseConfigTest
12
{
13
    public function testSimpleMessageFormatter(): void
14
    {
15
        $container = $this->createContainer();
16
17
        /** @var CategorySource $translationCategorySource */
18
        $translationCategorySource = $container->get('[email protected]')[0];
19
        $message = '{n, selectordinal, one{#-one} two{#-two} few{#-few} other{#-other}}';
20
        // The default formatter argument is ignored in favor of formatter set in config.
21
        $this->assertSame(
22
            '1',
23
            $translationCategorySource->format($message, ['n' => 1], 'en', new SimpleMessageFormatter()),
24
        );
25
    }
26
}
27