2007-01-29 20:11:00 +00:00
|
|
|
<?php
|
|
|
|
|
2007-08-01 14:06:59 +00:00
|
|
|
class HTMLPurifier_LanguageFactoryTest extends HTMLPurifier_Harness
|
2007-01-29 20:11:00 +00:00
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-05-15 23:04:46 +00:00
|
|
|
/**
|
|
|
|
* Protected reference of global factory we're testing.
|
|
|
|
*/
|
|
|
|
protected $factory;
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function setUp()
|
|
|
|
{
|
2008-05-15 23:04:46 +00:00
|
|
|
$this->factory = HTMLPurifier_LanguageFactory::instance();
|
|
|
|
parent::setUp();
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2013-07-16 11:56:14 +00:00
|
|
|
public function test()
|
|
|
|
{
|
2009-02-20 00:17:49 +00:00
|
|
|
$this->config->set('Core.Language', 'en');
|
2008-05-15 23:04:46 +00:00
|
|
|
$language = $this->factory->create($this->config, $this->context);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-29 20:11:00 +00:00
|
|
|
$this->assertIsA($language, 'HTMLPurifier_Language');
|
2007-05-05 20:17:04 +00:00
|
|
|
$this->assertIdentical($language->code, 'en');
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-29 20:11:00 +00:00
|
|
|
// lazy loading test
|
2007-05-05 20:17:04 +00:00
|
|
|
$this->assertIdentical(count($language->messages), 0);
|
2007-01-29 20:11:00 +00:00
|
|
|
$language->load();
|
|
|
|
$this->assertNotEqual(count($language->messages), 0);
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-29 20:11:00 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-01-29 20:11:00 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|