Page MenuHomeWickedGov Phorge

MhchemTest.php
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

MhchemTest.php

<?php
namespace MediaWiki\Extension\Math\Tests\WikiTexVC\Nodes;
use ArgumentCountError;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\Literal;
use MediaWiki\Extension\Math\WikiTexVC\Nodes\Mhchem;
use MediaWikiUnitTestCase;
use TypeError;
/**
* @covers \MediaWiki\Extension\Math\WikiTexVC\Nodes\Mhchem
*/
class MhchemTest extends MediaWikiUnitTestCase {
public function testEmptyMhchem() {
$this->expectException( ArgumentCountError::class );
new Mhchem();
throw new ArgumentCountError( 'Should not create an empty Mhchem' );
}
public function testOneArgumentMhchem() {
$this->expectException( ArgumentCountError::class );
new Mhchem( '\\f' );
throw new ArgumentCountError( 'Should not create a Mhchem with one argument' );
}
public function testIncorrectTypeMhchem() {
$this->expectException( TypeError::class );
new Mhchem( '\\f', 'x' );
throw new TypeError( 'Should not create a Mhchem with incorrect type' );
}
public function testBasicFunctionMhchem() {
$f = new Mhchem( '\\f', new Literal( 'a' ) );
$this->assertEquals( '{\\f {a}}', $f->render(), 'Should create a basic function' );
}
public function testCurliesMhchem() {
$f = new Mhchem( '\\f', new Literal( 'a' ) );
$this->assertEquals( '{{\\f {a}}}', $f->inCurlies(),
'Should create curlies' );
}
public function testExtractIdentifiersMhchem() {
$n = new Mhchem( '\\f', new Literal( 'a' ) );
$this->assertEquals( [], $n->extractIdentifiers(),
'Should extract identifiers' );
}
}

File Metadata

Mime Type
text/x-php
Expires
Sat, Nov 21, 23:26 (1 d, 21 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
14/a2/0edf1c052830787f05d7fdb8b15a
Default Alt Text
MhchemTest.php (1 KB)

Event Timeline