ResponseTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A constructNoArguments() 0 7 1
A constructWithArguments() 0 7 1
A constructWithArgumentsData() 0 7 1
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