Issues (2)

tests/LevelValidatorTraitTest.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace SubjectivePHPTest\Psr\Log;
4
5
use SubjectivePHP\Psr\Log\LevelValidatorTrait;
6
7
/**
8
 * @coversDefaultClass \SubjectivePHP\Psr\Log\LevelValidatorTrait
9
 */
10
final class LevelValidatorTraitTest extends \PHPUnit\Framework\TestCase
11
{
12
    use LevelValidatorTrait;
13
14
    /**
15
     * @test
16
     * @covers ::validateLevel
17
     *
18
     * @return void
19
     */
20
    public function validateLevelValid()
21
    {
22
        foreach ((new \ReflectionClass('\\Psr\\Log\\LogLevel'))->getConstants() as $constant) {
23
            $this->assertNull($this->validateLevel($constant));
0 ignored issues
show
Are you sure the usage of $this->validateLevel($constant) targeting SubjectivePHPTest\Psr\Lo...itTest::validateLevel() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

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

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

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

Loading history...
24
        }
25
    }
26
27
    /**
28
     * @test
29
     * @covers ::validateLevel
30
     *
31
     * @return void
32
     */
33
    public function validateLevelInvalid()
34
    {
35
        $this->expectException(\Psr\Log\InvalidArgumentException::class);
36
        $this->validateLevel('invalid');
37
    }
38
}
39