diff options
author | Legoktm <legoktm@member.fsf.org> | 2019-06-13 23:00:08 +0000 |
---|---|---|
committer | Legoktm <legoktm@member.fsf.org> | 2019-06-13 23:00:08 +0000 |
commit | 4e35134f7a3228a8195a07f49c85188e57ab8487 (patch) | |
tree | d9750a18496af4c52eb5dfce56f0d0b79fbd32cb /tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php | |
parent | 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9 (diff) | |
download | mediawikicore-4e35134f7a3228a8195a07f49c85188e57ab8487.tar.gz mediawikicore-4e35134f7a3228a8195a07f49c85188e57ab8487.zip |
Revert "Separate MediaWiki unit and integration tests"
This reverts commit 0a2b996278e57a8b8c5377cd3a3eaa54f993d4a9.
Reason for revert: Broke postgres tests.
Change-Id: I27d8e0c807ad5f0748b9611a4f3df84cc213fbe1
Diffstat (limited to 'tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php')
-rw-r--r-- | tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php b/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php new file mode 100644 index 000000000000..7f56b60529c6 --- /dev/null +++ b/tests/phpunit/includes/GlobalFunctions/wfStringToBoolTest.php @@ -0,0 +1,51 @@ +<?php + +/** + * @group GlobalFunctions + * @covers ::wfStringToBool + */ +class WfStringToBoolTest extends MediaWikiTestCase { + + public function getTestCases() { + return [ + [ 'true', true ], + [ 'on', true ], + [ 'yes', true ], + [ 'TRUE', true ], + [ 'YeS', true ], + [ 'On', true ], + [ '1', true ], + [ '+1', true ], + [ '01', true ], + [ '-001', true ], + [ ' 1', true ], + [ '-1 ', true ], + [ '', false ], + [ '0', false ], + [ 'false', false ], + [ 'NO', false ], + [ 'NOT', false ], + [ 'never', false ], + [ '!&', false ], + [ '-0', false ], + [ '+0', false ], + [ 'forget about it', false ], + [ ' on', false ], + [ 'true ', false ], + ]; + } + + /** + * @dataProvider getTestCases + * @param string $str + * @param bool $bool + */ + public function testStr2Bool( $str, $bool ) { + if ( $bool ) { + $this->assertTrue( wfStringToBool( $str ) ); + } else { + $this->assertFalse( wfStringToBool( $str ) ); + } + } + +} |