Completed
Push — master ( 3e6e05...cbeae7 )
by Chad
9s
created

MessageValidatorTraitTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 46
rs 10
c 0
b 0
f 0

3 Methods

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