Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7419203
LengthSpecTest.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
LengthSpecTest.php
View Options
<?php
namespace
MediaWiki\Extension\Math\Tests\WikiTexVC\Nodes
;
use
ArgumentCountError
;
use
InvalidArgumentException
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\LengthSpec
;
use
MediaWikiUnitTestCase
;
use
TypeError
;
/**
* @covers \MediaWiki\Extension\Math\WikiTexVC\Nodes\LengthSpec
*/
class
LengthSpecTest
extends
MediaWikiUnitTestCase
{
public
function
testEmptyLengthSpec
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
LengthSpec
();
}
public
function
testInvalidNumber
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
new
LengthSpec
(
'+'
,
[
'1'
],
'pt'
);
}
public
function
testNullUnit
()
{
$this
->
expectException
(
TypeError
::
class
);
new
LengthSpec
(
'+'
,
[
'1'
,
'.'
,
'0'
],
null
);
}
public
function
testRenderLengthSpec
()
{
$lengthSpec
=
new
LengthSpec
(
'+'
,
[
[
'1'
],
'.'
,
[
'0'
]
],
'pt'
);
$this
->
assertEquals
(
'[+1.0pt]'
,
$lengthSpec
->
render
()
);
}
public
function
testRenderLengthSpec2
()
{
$lengthSpec
=
new
LengthSpec
(
'+'
,
[
'.'
,
[
'0'
]
],
'pt'
);
$this
->
assertEquals
(
'[+.0pt]'
,
$lengthSpec
->
render
()
);
}
public
function
testRenderLengthSpecLong
()
{
$lengthSpec
=
new
LengthSpec
(
null
,
[
[
'1'
,
'2'
,
'3'
],
'.'
,
[
'4'
,
'5'
,
'6'
]
],
'pt'
);
$this
->
assertEquals
(
'[123.456pt]'
,
$lengthSpec
->
render
()
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 04:20 (1 d, 6 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
58/24/3e877660099f31df79cde1e1f667
Default Alt Text
LengthSpecTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment