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

FallbackLocaleResolverTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 10
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 5
dl 0
loc 10
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 2 1
A testResolve() 0 3 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 FallbackLocaleResolverTest extends \Tester\TestCase {
15
  protected FallbackLocaleResolver $resolver;
16
  
17
  protected function setUp(): void {
18
    $this->resolver = new FallbackLocaleResolver();
19
  }
20
  
21
  public function testResolve(): void {
22
    $lang = $this->resolver->resolve();
1 ignored issue
show
Bug introduced by
Are you sure the assignment to $lang is correct as $this->resolver->resolve() targeting Nexendrie\Translation\Re...caleResolver::resolve() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
23
    Assert::type("null", $lang);
24
  }
25
}
26
27
$test = new FallbackLocaleResolverTest();
28
$test->run();
29
?>