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

BoolValueParserTest   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 59
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 5
c 1
b 0
f 0
lcom 1
cbo 2
dl 0
loc 59
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testCanParse() 0 4 1
A getCanParseData() 0 12 1
A testParse() 0 4 1
A getParseData() 0 7 1
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