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

EnvironmentLocaleResolverTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
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 EnvironmentLocaleResolverTest extends \Tester\TestCase {
15
  protected EnvironmentLocaleResolver $resolver;
16
  
17
  protected function setUp(): void {
18
    $this->resolver = new EnvironmentLocaleResolver();
19
  }
20
  
21
  public function testResolve(): void {
22
    Assert::null($this->resolver->resolve());
23
    $this->resolver->lang = "cs";
24
    Assert::same("cs", $this->resolver->resolve());
25
    $this->resolver->lang = null;
26
    Assert::null($this->resolver->resolve());
27
  }
28
  
29
  public function testCustomVarName(): void {
30
    $oldValue = $this->resolver->varName;
31
    $this->resolver->varName = "LANGUAGE";
32
    $this->resolver->lang = "cs";
33
    Assert::same("cs", $this->resolver->resolve());
34
    $this->resolver->varName = $oldValue;
35
  }
36
}
37
38
$test = new EnvironmentLocaleResolverTest();
39
$test->run();
40
?>