1 | <?php |
||
2 | |||
3 | namespace SubjectivePHPTest\Psr\Log; |
||
4 | |||
5 | use SubjectivePHP\Psr\Log\MessageValidatorTrait; |
||
6 | |||
7 | /** |
||
8 | * @coversDefaultClass \SubjectivePHP\Psr\Log\MessageValidatorTrait |
||
9 | */ |
||
10 | final class MessageValidatorTraitTest extends \PHPUnit\Framework\TestCase |
||
11 | { |
||
12 | use MessageValidatorTrait; |
||
13 | |||
14 | /** |
||
15 | * @param mixed $message The message that will validate. |
||
16 | * |
||
17 | * @test |
||
18 | * @covers ::validateMessage |
||
19 | * @dataProvider provideValidValidateData |
||
20 | * |
||
21 | * @return void |
||
22 | */ |
||
23 | public function validateMessageValid($message) |
||
24 | { |
||
25 | $this->assertNull($this->validateMessage($message)); |
||
0 ignored issues
–
show
|
|||
26 | } |
||
27 | |||
28 | /** |
||
29 | * Provides valid messages for testing. |
||
30 | * |
||
31 | * @return array |
||
32 | */ |
||
33 | public function provideValidValidateData() |
||
34 | { |
||
35 | return [ |
||
36 | ['a string' => 'the message'], |
||
37 | ['a boolean' => true], |
||
38 | ['an int' => 123], |
||
39 | ['a float' => 12.3], |
||
40 | ['an object' => new \SplFileInfo(__FILE__)], |
||
41 | ]; |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @test |
||
46 | * @covers ::validateMessage |
||
47 | * |
||
48 | * @return void |
||
49 | */ |
||
50 | public function validateMessageInvalid() |
||
51 | { |
||
52 | $this->expectException(\Psr\Log\InvalidArgumentException::class); |
||
53 | $this->validateMessage(new \StdClass()); |
||
54 | } |
||
55 | } |
||
56 |
This check looks for function or method calls that always return null and whose return value is used.
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.