Test Failed
Push — master ( 8413e5...65cae7 )
by Jakub
02:11
created

SessionLocaleResolverTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 21
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testResolver() 0 6 1
A setUp() 0 2 1
A testCustomVarName() 0 4 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Nexendrie\Translation\Resolvers;
5
6
use Tester\Assert;
7
8
require __DIR__ . "/../../../bootstrap.php";
9
10
/**
11
 * @author Jakub Konečný
12
 * @testCase
13
 */
14
final class SessionLocaleResolverTest extends \Tester\TestCase {
15
  use \Testbench\TCompiledContainer;
16
17
  protected SessionLocaleResolver $resolver;
18
  
19
  protected function setUp(): void {
20
    $this->resolver = new SessionLocaleResolver();
21
  }
22
  
23
  public function testResolver(): void {
24
    Assert::null($this->resolver->resolve());
25
    $this->resolver->lang = "en";
26
    Assert::same("en", $this->resolver->resolve());
27
    $this->resolver->lang = null;
28
    Assert::null($this->resolver->resolve());
29
  }
30
  
31
  public function testCustomVarName(): void {
32
    $this->resolver->varName = "locale";
33
    $this->resolver->lang = "en";
34
    Assert::same("en", $this->resolver->resolve());
35
  }
36
}
37
38
$test = new SessionLocaleResolverTest();
39
$test->run();
40
?>