TranslatorTest.php 823 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. namespace Elgg\I18n;
  3. use PHPUnit_Framework_TestCase as TestCase;
  4. class TranslatorTest extends TestCase {
  5. public function testSetLanguageFromGetParameter() {
  6. $translator = new Translator();
  7. $input_lang = 'nl';
  8. _elgg_services()->input->set('hl', $input_lang);
  9. $lang = $translator->getLanguage();
  10. $this->assertEquals($lang, $input_lang);
  11. }
  12. public function testCheckLanguageKeyExists() {
  13. $translator = new Translator();
  14. $translator->addTranslation('en', array('__elgg_php_unit:test_key' => 'Dummy'));
  15. $this->assertTrue($translator->languageKeyExists('__elgg_php_unit:test_key'));
  16. $this->assertFalse($translator->languageKeyExists('__elgg_php_unit:test_key:missing'));
  17. }
  18. public function testDoesNotPerformSprintfFormattingIfArgsNotProvided() {
  19. $this->markTestIncomplete();
  20. }
  21. }