Completed
Branch feature/scrutinizer (5874ea)
by X
03:07
created

BooleanParserTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A provideInvalidData() 0 23 1
A testParseFailure() 0 6 1
1
<?php
2
3
namespace xKerman\Restricted\Test;
4
5
use PHPUnit\Framework\TestCase;
6
7
use xKerman\Restricted\BooleanParser;
8
use xKerman\Restricted\Source;
9
10
class BooleanParserTest extends TestCase
11
{
12
    public function provideInvalidData()
13
    {
14
        return [
15
            'empty string' => [
16
                'input' => '',
17
            ],
18
            'not boolean' => [
19
                'input' => 'i:0;',
20
            ],
21
            'missing tag' => [
22
                'input' => ':0;',
23
            ],
24
            'missing value' => [
25
                'input' => 'b:;',
26
            ],
27
            'missing semicolon' => [
28
                'input' => 'b:0',
29
            ],
30
            'value is not boolean' => [
31
                'input' => 'b:2;',
32
            ],
33
        ];
34
    }
35
36
    /**
37
     * @covers \xKerman\Restricted\BooleanParser
38
     * @dataProvider provideInvalidData
39
     * @expectedException \xKerman\Restricted\UnserializeFailedException
40
     */
41
    public function testParseFailure($input)
42
    {
43
        $source = new Source($input);
44
        $parser = new BooleanParser();
45
        $parser->parse($source);
46
    }
47
}
48