ResolverTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 14
c 1
b 0
f 0
dl 0
loc 26
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testChainResolver() 0 18 1
A testStaticResolver() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Efabrica\Tests;
6
7
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
8
use Efabrica\Translatte\Resolver\StaticResolver;
9
use Efabrica\Translatte\Resolver\ChainResolver;
10
11
class ResolverTest extends TestCase
12
{
13
    public function testStaticResolver(): void
14
    {
15
        $resolver = new StaticResolver('sk_SK');
16
        $this->assertSame('sk_SK', $resolver->resolve());
17
    }
18
19
    public function testChainResolver(): void
20
    {
21
        $resolver1 = new ChainResolver([
22
            new StaticResolver('sk_SK')
23
        ]);
24
        $this->assertSame('sk_SK', $resolver1->resolve());
25
26
        $resolver2 = new ChainResolver([
27
            new StaticResolver(''),
28
            new StaticResolver('en_US')
29
        ]);
30
        $this->assertSame('en_US', $resolver2->resolve());
31
32
        $resolver3 = new ChainResolver([
33
            new StaticResolver(''),
34
            new StaticResolver('')
35
        ]);
36
        $this->assertNull($resolver3->resolve());
37
    }
38
}
39