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

SimpleTest::testClassExistence()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
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