Passed
Branch master (d8ab5e)
by Max
05:15 queued 02:56
created

SimpleTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 44
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testSetDataFromConfig() 0 11 1
A testSetEmptyDataFromBadConfig() 0 11 1
A testClassExistence() 0 3 1
1
<?php
2
3
namespace EasyDictionary\DataProvider;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
8
 * @coversDefaultClass \EasyDictionary\DataProvider\Simple
9
 */
10
class SimpleTest extends TestCase
11
{
12
    /**
13
     * @covers \EasyDictionary\DataProvider\Simple
14
     */
15
    public function testClassExistence()
16
    {
17
        self::assertTrue(class_exists('\EasyDictionary\DataProvider\Simple'));
18
    }
19
20
    /**
21
     * @covers ::__construct
22
     * @covers ::setData
23
     * @covers ::getData
24
     */
25
    public function testSetDataFromConfig()
26
    {
27
        $config = [
28
            'items' => [
29
                1, 2, 3
30
            ]
31
        ];
32
33
        $dataProvider = new Simple($config);
34
35
        self::assertEquals([1, 2, 3], $dataProvider->getData());
36
    }
37
38
    /**
39
     * @covers ::__construct
40
     * @covers ::setData
41
     * @covers ::getData
42
     */
43
    public function testSetEmptyDataFromBadConfig()
44
    {
45
        $config = [
46
            'items2' => [
47
                1, 2, 3
48
            ]
49
        ];
50
51
        $dataProvider = new Simple($config);
52
53
        self::assertEquals([], $dataProvider->getData());
54
    }
55
}
56