Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F7421095
ChemWordTest.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
ChemWordTest.php
View Options
<?php
namespace
MediaWiki\Extension\Math\Tests\WikiTexVC\Nodes
;
use
ArgumentCountError
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\ChemWord
;
use
MediaWiki\Extension\Math\WikiTexVC\Nodes\Literal
;
use
MediaWikiUnitTestCase
;
use
RuntimeException
;
use
TypeError
;
/**
* @covers \MediaWiki\Extension\Math\WikiTexVC\Nodes\ChemWord
*/
class
ChemWordTest
extends
MediaWikiUnitTestCase
{
public
function
testEmptyChemWord
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
ChemWord
();
throw
new
ArgumentCountError
(
'Should not create an empty ChemWord'
);
}
public
function
testOneArgumentChemWord
()
{
$this
->
expectException
(
ArgumentCountError
::
class
);
new
ChemWord
(
new
Literal
(
'a'
)
);
throw
new
ArgumentCountError
(
'Should not create a ChemWord with one argument'
);
}
public
function
testIncorrectTypeChemWord
()
{
$this
->
expectException
(
TypeError
::
class
);
new
ChemWord
(
'a'
,
'b'
);
throw
new
RuntimeException
(
'Should not create a ChemWord with incorrect type'
);
}
public
function
testBasicFunctionChemWord
()
{
$chemWord
=
new
ChemWord
(
new
Literal
(
'a'
),
new
Literal
(
'b'
)
);
$this
->
assertEquals
(
'ab'
,
$chemWord
->
render
(),
'Should create a basic function'
);
}
public
function
testGetters
()
{
$chemWord
=
new
ChemWord
(
new
Literal
(
'a'
),
new
Literal
(
'b'
)
);
$this
->
assertNotEmpty
(
$chemWord
->
getLeft
()
);
$this
->
assertNotEmpty
(
$chemWord
->
getRight
()
);
}
public
function
testExtractIdentifiersBox
()
{
$chemWord
=
new
ChemWord
(
new
Literal
(
'a'
),
new
Literal
(
'b'
)
);
$this
->
assertEquals
(
[],
$chemWord
->
extractIdentifiers
(),
'Should extract identifiers'
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Nov 22, 05:17 (1 d, 2 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d6/ec/b78a472e3bc2cca5a962240bf28d
Default Alt Text
ChemWordTest.php (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment