forked from DataValues/Common
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoolParserTest.php
More file actions
68 lines (57 loc) · 1.37 KB
/
BoolParserTest.php
File metadata and controls
68 lines (57 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
namespace ValueParsers\Test;
use DataValues\BooleanValue;
use ValueParsers\BoolParser;
/**
* @covers ValueParsers\BoolParser
* @covers ValueParsers\StringValueParser
*
* @group ValueParsers
* @group DataValueExtensions
*
* @license GPL-2.0+
* @author Jeroen De Dauw < jeroendedauw@gmail.com >
*/
class BoolParserTest extends StringValueParserTest {
/**
* @see ValueParserTestBase::getInstance
*
* @return BoolParser
*/
protected function getInstance() {
return new BoolParser();
}
/**
* @see ValueParserTestBase::validInputProvider
*/
public function validInputProvider() {
return [
[ 'yes', new BooleanValue( true ) ],
[ 'on', new BooleanValue( true ) ],
[ '1', new BooleanValue( true ) ],
[ 'true', new BooleanValue( true ) ],
[ 'no', new BooleanValue( false ) ],
[ 'off', new BooleanValue( false ) ],
[ '0', new BooleanValue( false ) ],
[ 'false', new BooleanValue( false ) ],
[ 'YeS', new BooleanValue( true ) ],
[ 'ON', new BooleanValue( true ) ],
[ 'No', new BooleanValue( false ) ],
[ 'OfF', new BooleanValue( false ) ],
];
}
/**
* @see StringValueParserTest::invalidInputProvider
*/
public function invalidInputProvider() {
$argLists = parent::invalidInputProvider();
$invalid = [
'foo',
'2',
];
foreach ( $invalid as $value ) {
$argLists[] = [ $value ];
}
return $argLists;
}
}