Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5983988
WfStringToBoolTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
963 B
Referenced Files
None
Subscribers
None
WfStringToBoolTest.php
View Options
<?php
/**
* @group GlobalFunctions
* @covers ::wfStringToBool
*/
class
WfStringToBoolTest
extends
MediaWikiUnitTestCase
{
public
static
function
provideTestCases
()
{
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 provideTestCases
* @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, 23:08 (1 w, 6 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
f1/2e/6fb6ca6fa2bfb804736747b57c97
Default Alt Text
WfStringToBoolTest.php (963 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment