-
Notifications
You must be signed in to change notification settings - Fork 1
/
MessageValidatorTraitTest.php
56 lines (50 loc) · 1.23 KB
/
MessageValidatorTraitTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace SubjectivePHPTest\Psr\Log;
use SubjectivePHP\Psr\Log\MessageValidatorTrait;
/**
* @coversDefaultClass \SubjectivePHP\Psr\Log\MessageValidatorTrait
* @covers ::<private>
*/
final class MessageValidatorTraitTest extends \PHPUnit\Framework\TestCase
{
use MessageValidatorTrait;
/**
* @param mixed $message The message that will validate.
*
* @test
* @covers ::validateMessage
* @dataProvider provideValidValidateData
*
* @return void
*/
public function validateMessageValid($message)
{
$this->assertNull($this->validateMessage($message));
}
/**
* Provides valid messages for testing.
*
* @return array
*/
public function provideValidValidateData()
{
return [
['a string' => 'the message'],
['a boolean' => true],
['an int' => 123],
['a float' => 12.3],
['an object' => new \SplFileInfo(__FILE__)],
];
}
/**
* @test
* @covers ::validateMessage
* @expectedException \Psr\Log\InvalidArgumentException
*
* @return void
*/
public function validateMessageInvalid()
{
$this->validateMessage(new \StdClass());
}
}