Completed
Push — master ( 7a6150...2f2994 )
by Chad
10s
created

ResponseTest::constructNoArguments()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
namespace TraderInteractive\SolveMedia;
3
4
use PHPUnit\Framework\TestCase;
5
6
/**
7
 * @coversDefaultClass \TraderInteractive\SolveMedia\Response
8
 */
9
class ResponseTest extends TestCase
10
{
11
    /**
12
     * @test
13
     * @covers ::__construct
14
     */
15
    public function constructNoArguments()
16
    {
17
        $response = new Response();
18
19
        $this->assertFalse($response->valid());
20
        $this->assertNull($response->getMessage());
21
    }
22
23
    /**
24
     * @test
25
     * @dataProvider constructWithArgumentsData
26
     * @covers ::__construct
27
     * @covers ::valid
28
     * @covers ::getMessage
29
     */
30
    public function constructWithArguments($isValid, $error)
31
    {
32
        $response = new Response($isValid, $error);
33
34
        $this->assertSame($isValid, $response->valid());
35
        $this->assertSame($error, $response->getMessage());
36
    }
37
38
    public function constructWithArgumentsData()
39
    {
40
        return [
41
            [true, ''],
42
            [false, 'error text'],
43
        ];
44
    }
45
}
46