Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5982243
WfStringToBoolTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
948 B
Referenced Files
None
Subscribers
None
WfStringToBoolTest.php
View Options
<?php
/**
* @group GlobalFunctions
* @covers ::wfStringToBool
*/
class
WfStringToBoolTest
extends
MediaWikiUnitTestCase
{
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
)
);
}
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sat, Oct 3, 22:16 (1 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
b4/3c/e5b6683656049f38d8fb288139bb
Default Alt Text
WfStringToBoolTest.php (948 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment