mediawiki-extensions-Math/tests/phpunit/unit/TexVC/MMLmappings/MMLParsingUtilTest.php
libraryupgrader dcce2100d0 build: Updating dependencies
composer:
* mediawiki/mediawiki-codesniffer: 39.0.0 → 41.0.0

npm:
* cookiejar: 2.1.3 → 2.1.4
  * https://github.com/advisories/GHSA-h452-7996-h45h
* http-cache-semantics: 4.1.0 → 4.1.1
  * https://github.com/advisories/GHSA-rc47-6667-2j5j
* ua-parser-js: 1.0.2 → 1.0.34
  * https://github.com/advisories/GHSA-fhg7-m89q-25r3

Change-Id: I4198e1cbdc115d27c9fe5b8d0ce813b514524796
2023-03-12 05:44:17 +00:00

33 lines
950 B
PHP

<?php
namespace MediaWiki\Extension\Math\Tests\TexVC\MMLmappings;
use MediaWiki\Extension\Math\TexVC\MMLmappings\Util\MMLParsingUtil;
use MediaWikiUnitTestCase;
/**
* @covers \MediaWiki\Extension\Math\TexVC\MMLmappings\Util\MMLParsingUtil
*/
class MMLParsingUtilTest extends MediaWikiUnitTestCase {
public function testInvalidColor() {
$result = MMLParsingUtil::parseDefineColorExpression( "INVALID" );
$this->assertNull( $result );
}
public function testRGBOne() {
$result = MMLParsingUtil::parseDefineColorExpression(
"\\definecolor {ultramarine}{rgb}{0,0.12549019607843,0.37647058823529}" );
$this->assertEquals( 'ultramarine', $result['name'] );
$this->assertEquals( 'rgb', $result['type'] );
$this->assertEquals( '#002060', $result['hex'] );
}
public function testInvalidColorString() {
$result = MMLParsingUtil::parseDefineColorExpression(
"\\definecolor {gray}{0.123}" );
$this->assertNull( $result );
}
}