ReadStatusTest::testValidReadStatuses()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 5
rs 9.4285
c 1
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
/*
4
 * This file is part of the MilioooMessageBundle package.
5
 *
6
 * (c) Michiel boeckaert <[email protected]>
7
 * This source file is subject to the MIT license that is bundled
8
 * with this source code in the file LICENSE.
9
 */
10
11
namespace Miliooo\Messaging\Tests\ValueObjects;
12
13
use Miliooo\Messaging\ValueObjects\ReadStatus;
14
use Miliooo\Messaging\Model\MessageMetaInterface;
15
16
/**
17
 * Test file for Read Status Value Object
18
 *
19
 * @author Michiel Boeckaert <[email protected]>
20
 */
21
class ReadStatusTest extends \PHPUnit_Framework_TestCase
22
{
23
    /**
24
     * @dataProvider invalidReadStatusProvider
25
     * @expectedException \InvalidArgumentException
26
     * @expectedExceptionMessage Read status is not valid
27
     */
28
    public function testInvalidReadStatuses($status)
29
    {
30
        new ReadStatus($status);
31
    }
32
33
    /**
34
     * Invalid statuses provider.
35
     *
36
     * @return array
37
     */
38
    public function invalidReadStatusProvider()
39
    {
40
        return [
41
            ['foo'],
42
            [null],
43
            [100],
44
            [[]]
45
        ];
46
    }
47
48
    /**
49
     * Valid statuses provider.
50
     *
51
     * @return array
52
     */
53
    public function validReadStatusProvider()
54
    {
55
        return [
56
            [MessageMetaInterface::READ_STATUS_NEVER_READ],
57
            [MessageMetaInterface::READ_STATUS_READ],
58
            [MessageMetaInterface::READ_STATUS_READ]
59
        ];
60
    }
61
62
    /**
63
     * @dataProvider validReadStatusProvider
64
     */
65
    public function testValidReadStatuses($status)
66
    {
67
        $statusValueObject = new ReadStatus($status);
68
        $this->assertEquals($status, $statusValueObject->getReadStatus());
69
    }
70
}
71