Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7423292
Fun4Test.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
Fun4Test.php
View Options
<?php
namespace
MediaWiki\Extension\Math\Tests\WikiTexVC\Nodes
;
use
ArgumentCountError
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\Fun4
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\Literal
;
use
MediaWikiUnitTestCase
;
use
RuntimeException
;
use
TypeError
;
/**
* @covers \MediaWiki\Extension\Math\WikiTexVC\Nodes\Fun4
*/
class
Fun4Test
extends
MediaWikiUnitTestCase
{
public
function
testEmptyFun4
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
Fun4
();
throw
new
ArgumentCountError
(
'Should not create an empty fun4'
);
}
public
function
testOneArgumentFun4
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
Fun4
(
'
\\
f'
);
throw
new
ArgumentCountError
(
'Should not create a fun4 with one argument'
);
}
public
function
testIncorrectTypeFun4
()
{
$this
->
expectException
(
TypeError
::
class
);
new
Fun4
(
'
\\
f'
,
'a'
,
'b'
,
'c'
,
'd'
);
throw
new
RuntimeException
(
'Should not create a fun4 with incorrect types'
);
}
public
function
testBasicFunctionFun4
()
{
$f
=
new
Fun4
(
'
\\
f'
,
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
),
new
Literal
(
'd'
)
);
$this
->
assertEquals
(
'{
\\
f {a}{b}{c}{d}}'
,
$f
->
render
(),
'Should create a basic function'
);
}
public
function
testGetters
()
{
$f
=
new
Fun4
(
'
\\
f'
,
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
),
new
Literal
(
'd'
)
);
$this
->
assertNotEmpty
(
$f
->
getFname
()
);
$this
->
assertNotEmpty
(
$f
->
getArg1
()
);
$this
->
assertNotEmpty
(
$f
->
getArg2
()
);
$this
->
assertNotEmpty
(
$f
->
getArg3
()
);
$this
->
assertNotEmpty
(
$f
->
getArg4
()
);
}
public
function
testCurliesFun4
()
{
$f
=
new
Fun4
(
'
\\
f'
,
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
),
new
Literal
(
'd'
)
);
$this
->
assertEquals
(
'{
\\
f {a}{b}{c}{d}}'
,
$f
->
inCurlies
(),
'Should create exactly one set of curlies'
);
}
public
function
testExtractIdentifiersFun4
()
{
$f
=
new
Fun4
(
'
\\
f'
,
new
Literal
(
'a'
),
new
Literal
(
'b'
),
new
Literal
(
'c'
),
new
Literal
(
'd'
)
);
$this
->
assertEquals
(
[
'a'
,
'b'
,
'c'
,
'd'
],
$f
->
extractIdentifiers
(),
'Should extract identifiers'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 06:31 (1 d, 8 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
ac/7f/a266535ba9bb7a2a85c29abe6951
Default Alt Text
Fun4Test.php (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment