Completed
Push — master ( e8fccd...9c2126 )
by Harry
02:44
created

BoolValueParserTest::getCanParseData()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 12
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 12
rs 9.4285
cc 1
eloc 9
nc 1
nop 0
1
<?php
2
3
namespace Graze\CsvToken\Test\Unit\ValueParser;
4
5
use Graze\CsvToken\Test\TestCase;
6
use Graze\CsvToken\ValueParser\BoolValueParser;
7
8
class BoolValueParserTest extends TestCase
9
{
10
    /** @var BoolValueParser */
11
    private $parser;
12
13
    public function setUp()
14
    {
15
        $this->parser = new BoolValueParser();
16
    }
17
18
    /**
19
     * @dataProvider getCanParseData
20
     *
21
     * @param string $string
22
     * @param bool   $expected
23
     */
24
    public function testCanParse($string, $expected)
25
    {
26
        static::assertEquals($expected, $this->parser->canParseValue($string));
27
    }
28
29
    /**
30
     * @return array
31
     */
32
    public function getCanParseData()
33
    {
34
        return [
35
            ['true', true],
36
            ['false', true],
37
            ['yes', false],
38
            ['no', false],
39
            ['1', false],
40
            ['0', false],
41
            ['bool', false],
42
        ];
43
    }
44
45
    /**
46
     * @dataProvider getParseData
47
     *
48
     * @param string $string
49
     * @param bool   $expected
50
     */
51
    public function testParse($string, $expected)
52
    {
53
        static::assertEquals($expected, $this->parser->parseValue($string));
54
    }
55
56
    /**
57
     * @return array
58
     */
59
    public function getParseData()
60
    {
61
        return [
62
            ['true', true],
63
            ['false', false],
64
        ];
65
    }
66
}
67