|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file is part of the core-library package. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) 2017 NdC/WBW |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace WBW\Library\Core\Tests\Utility; |
|
13
|
|
|
|
|
14
|
|
|
use PHPUnit_Framework_TestCase; |
|
15
|
|
|
use WBW\Library\Core\Utility\BooleanUtility; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Boolean utility test. |
|
19
|
|
|
* |
|
20
|
|
|
* @author NdC/WBW <https://github.com/webeweb/> |
|
21
|
|
|
* @package WBW\Library\Core\Tests\Utility |
|
22
|
|
|
* @final |
|
23
|
|
|
*/ |
|
24
|
|
|
final class BooleanUtilityTest extends PHPUnit_Framework_TestCase { |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* Tests the parseString() method. |
|
28
|
|
|
* |
|
29
|
|
|
* @return void |
|
30
|
|
|
*/ |
|
31
|
|
|
public function testParseString() { |
|
32
|
|
|
|
|
33
|
|
|
$this->assertEquals(false, BooleanUtility::parseString(null)); |
|
34
|
|
|
$this->assertEquals(false, BooleanUtility::parseString("")); |
|
35
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("1")); |
|
36
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("O")); |
|
37
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("o")); |
|
38
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("OK")); |
|
39
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("ok")); |
|
40
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("OUI")); |
|
41
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("oui")); |
|
42
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("TRUE")); |
|
43
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("true")); |
|
44
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("Y")); |
|
45
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("y")); |
|
46
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("YES")); |
|
47
|
|
|
$this->assertEquals(true, BooleanUtility::parseString("yes")); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
} |
|
51
|
|
|
|