gplx/mediawiki/extensions/SemanticMediaWiki/Tesa/tests/phpunit/Unit/NormalizerTest.php

73 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Onoi\Tesa\Tests;
use Onoi\Tesa\Normalizer;
use PHPUnit\Framework\TestCase;
/**
* @covers \Onoi\Tesa\Normalizer
* @group onoi-tesa
*
* @license GPL-2.0-or-later
* @since 0.1
*
* @author mwjames
*/
class NormalizerTest extends TestCase {
public function testTransliteration() {
$this->assertEquals(
'AAAAAEAaaaaaeaOOOOOOEOoooooeoEEEEeeeeðCcÐIIIIiiiiUUUUEuuuueNnSsYyyZz',
Normalizer::applyTransliteration( 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž' )
);
}
public function testConvertDoubleWidth() {
$this->assertSame(
'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz',
Normalizer::convertDoubleWidth( '' )
);
}
public function testReduceLengthTo() {
$this->assertEquals(
'ABC',
Normalizer::reduceLengthTo( 'ABCDEF', 3 )
);
$this->assertEquals(
'ABCDEF',
Normalizer::reduceLengthTo( 'ABCDEF' )
);
$this->assertEquals(
'ABCD',
Normalizer::reduceLengthTo( 'ABCD EF', 4 )
);
$this->assertEquals(
'ABC',
Normalizer::reduceLengthTo( 'ABC D EF', 4 )
);
$this->assertEquals(
'ABCD',
Normalizer::reduceLengthTo( 'ABCD EF', 5 )
);
$this->assertEquals(
'abc def gh',
Normalizer::reduceLengthTo( 'abc def gh in 123', 12 )
);
}
public function testToLowercase() {
$this->assertEquals(
'abcdef',
Normalizer::toLowercase( 'ABCDEF' )
);
}
}