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

ExpressionParserTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A provideInvalidData() 0 11 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\ExpressionParser;
8
use xKerman\Restricted\Source;
9
10
class ExpressionParserTest extends TestCase
11
{
12
    public function provideInvalidData()
13
    {
14
        return [
15
            'empty string' => [
16
                'input' => '',
17
            ],
18
            'invalid tag' => [
19
                'input' => 'x:2:"aa";',
20
            ],
21
        ];
22
    }
23
24
    /**
25
     * @covers \xKerman\Restricted\ExpressionParser
26
     * @dataProvider provideInvalidData
27
     * @expectedException \xKerman\Restricted\UnserializeFailedException
28
     */
29
    public function testParseFailure($input)
30
    {
31
        $source = new Source($input);
32
        $parser = new ExpressionParser();
33
        $parser->parse($source);
34
    }
35
}
36