mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-08 23:08:42 +00:00
6a95d91a1a
- Fix oversight in AutoParagraph dealing with armor. - Order errors with no line number last - Language object now needs $config and $context objects to do parameterized objects - Auto-close notice added - Token constructors accept line numbers git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1245 48356398-32a2-884e-a903-53898d9a118a
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/LanguageFactory.php';
|
|
|
|
class HTMLPurifier_LanguageFactoryTest extends UnitTestCase
|
|
{
|
|
|
|
function test() {
|
|
|
|
$factory = HTMLPurifier_LanguageFactory::instance();
|
|
|
|
$config = HTMLPurifier_Config::create(array('Core.Language' => 'en'));
|
|
$context = new HTMLPurifier_Context();
|
|
$language = $factory->create($config, $context);
|
|
|
|
$this->assertIsA($language, 'HTMLPurifier_Language');
|
|
$this->assertIdentical($language->code, 'en');
|
|
|
|
// lazy loading test
|
|
$this->assertIdentical(count($language->messages), 0);
|
|
$language->load();
|
|
$this->assertNotEqual(count($language->messages), 0);
|
|
|
|
// actual tests for content can be found in LanguageTest
|
|
|
|
}
|
|
|
|
function testFallback() {
|
|
|
|
$factory = HTMLPurifier_LanguageFactory::instance();
|
|
|
|
$config = HTMLPurifier_Config::create(array('Core.Language' => 'en-x-test'));
|
|
$context = new HTMLPurifier_Context();
|
|
|
|
$language = $factory->create($config, $context);
|
|
|
|
$this->assertIsA($language, 'HTMLPurifier_Language_en_x_test');
|
|
$this->assertIdentical($language->code, 'en-x-test');
|
|
|
|
$language->load();
|
|
|
|
// test overloaded message
|
|
$this->assertIdentical($language->getMessage('HTMLPurifier'), 'HTML Purifier X');
|
|
|
|
// test inherited message
|
|
$this->assertIdentical($language->getMessage('LanguageFactoryTest: Pizza'), 'Pizza');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|