| 1 | <?php |
||
| 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 |