@@ 13-23 (lines=11) @@ | ||
10 | /** |
|
11 | * @dataProvider configProvider |
|
12 | */ |
|
13 | public function testTruthyValues($binaries) |
|
14 | { |
|
15 | $formatter = new BooleanFormatter(); |
|
16 | $formatter->setBinaries($binaries); |
|
17 | ||
18 | $this->assertTrue($formatter->format('true')); |
|
19 | $this->assertTrue($formatter->format('enabled')); |
|
20 | $this->assertTrue($formatter->format('1')); |
|
21 | $this->assertTrue($formatter->format('on')); |
|
22 | $this->assertFalse($formatter->format('foo')); |
|
23 | } |
|
24 | ||
25 | /** |
|
26 | * @dataProvider configProvider |
|
@@ 28-40 (lines=13) @@ | ||
25 | /** |
|
26 | * @dataProvider configProvider |
|
27 | */ |
|
28 | public function testFalseyValues($binaries) |
|
29 | { |
|
30 | $formatter = new BooleanFormatter(); |
|
31 | $formatter->setNullable(true); |
|
32 | $formatter->setBinaries($binaries); |
|
33 | ||
34 | $this->assertFalse($formatter->format('false')); |
|
35 | $this->assertFalse($formatter->format('disabled')); |
|
36 | $this->assertFalse($formatter->format('0')); |
|
37 | $this->assertFalse($formatter->format('off')); |
|
38 | ||
39 | $this->assertNull($formatter->format('bar')); |
|
40 | } |
|
41 | ||
42 | public function configProvider() |
|
43 | { |