LanguagesTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. require_once 'application/Languages.php';
  3. /**
  4. * Class LanguagesTest.
  5. */
  6. class LanguagesTest extends PHPUnit_Framework_TestCase
  7. {
  8. /**
  9. * Test t() with a simple non identified value.
  10. */
  11. public function testTranslateSingleNotID()
  12. {
  13. $text = 'abcdé 564 fgK';
  14. $this->assertEquals($text, t($text));
  15. }
  16. /**
  17. * Test t() with a non identified plural form.
  18. */
  19. public function testTranslatePluralNotID()
  20. {
  21. $text = '%s sandwich';
  22. $nText = '%s sandwiches';
  23. $this->assertEquals('0 sandwich', t($text, $nText));
  24. $this->assertEquals('1 sandwich', t($text, $nText, 1));
  25. $this->assertEquals('2 sandwiches', t($text, $nText, 2));
  26. }
  27. /**
  28. * Test t() with a non identified invalid plural form.
  29. */
  30. public function testTranslatePluralNotIDInvalid()
  31. {
  32. $text = 'sandwich';
  33. $nText = 'sandwiches';
  34. $this->assertEquals('sandwich', t($text, $nText, 1));
  35. $this->assertEquals('sandwiches', t($text, $nText, 2));
  36. }
  37. }