Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F2753687
MathValidatorTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
MathValidatorTest.php
View Options
<?php
use
DataValues\NumberValue
;
use
DataValues\StringValue
;
use
MediaWiki\Extension\Math\MathValidator
;
/**
* @covers \MediaWiki\Extension\Math\MathValidator
*
* @group Math
*
* @license GPL-2.0-or-later
*/
class
MathValidatorTest
extends
MediaWikiIntegrationTestCase
{
use
MockHttpTrait
;
private
const
VADLID_TEX
=
"
\s
in x"
;
private
const
INVADLID_TEX
=
"
\\
notExists"
;
public
function
testNotStringValue
()
{
$validator
=
new
MathValidator
();
$this
->
expectException
(
InvalidArgumentException
::
class
);
$validator
->
validate
(
new
NumberValue
(
0
)
);
}
public
function
testNullValue
()
{
$validator
=
new
MathValidator
();
$this
->
expectException
(
InvalidArgumentException
::
class
);
$validator
->
validate
(
null
);
}
public
function
testValidInput
()
{
$this
->
installMockHttp
(
$this
->
makeFakeHttpRequest
(
file_get_contents
(
__DIR__
.
'/InputCheck/data/mathoid/sinx.json'
)
)
);
$validator
=
new
MathValidator
();
$result
=
$validator
->
validate
(
new
StringValue
(
self
::
VADLID_TEX
)
);
$this
->
assertInstanceOf
(
\ValueValidators\Result
::
class
,
$result
);
$this
->
assertTrue
(
$result
->
isValid
()
);
}
public
function
testInvalidInput
()
{
$this
->
installMockHttp
(
$this
->
makeFakeHttpRequest
(
file_get_contents
(
__DIR__
.
'/InputCheck/data/mathoid/invalidF.json'
),
400
)
);
$validator
=
new
MathValidator
();
$result
=
$validator
->
validate
(
new
StringValue
(
self
::
INVADLID_TEX
)
);
$this
->
assertInstanceOf
(
\ValueValidators\Result
::
class
,
$result
);
$this
->
assertFalse
(
$result
->
isValid
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Fri, Jul 3, 21:35 (15 h, 14 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d0/4a/2ec03f18e0d269c0b41fec91eacb
Default Alt Text
MathValidatorTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment