Passed
Push — master ( 3bddf7...37f0e3 )
by Max
07:30
created

CallbackTest::testSetBadCallbackFromBadConfig()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
namespace EasyDictionary\DataProvider;
4
5
use PHPUnit\Framework\TestCase;
6
7
/**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
8
 * @coversDefaultClass \EasyDictionary\DataProvider\Callback
9
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @author tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
10
class CallbackTest extends TestCase
11
{
12
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
13
     * @covers \EasyDictionary\DataProvider\Callback
14
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
15
    public function testClassExistence()
16
    {
17
        self::assertTrue(class_exists('\EasyDictionary\DataProvider\Callback'));
18
    }
19
20
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
21
     * @covers ::__construct
22
     * @covers ::setCallback
23
     * @covers ::getData
24
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
25
    public function testSetDataFromConfig()
26
    {
27
        $callable = function ($b) {
28
            return [111, $b];
29
        };
30
31
        $config = [
32
            'callable' => $callable,
33
            'callableArgs' => [777],
34
        ];
35
36
        $dataProvider = new Callback($config);
37
        self::assertEquals([111, 777], $dataProvider->getData());
38
    }
39
40
    /**
0 ignored issues
show
Coding Style introduced by
Missing short description in doc comment
Loading history...
41
     * @covers ::__construct
42
     * @covers ::setCallback
43
     * @covers ::getData
44
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
45
    public function testSetBadCallbackFromBadConfig()
46
    {
47
        $dataProvider = new Callback();
48
        self::assertEquals([], $dataProvider->getData());
49
    }
50
}
51