lang.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * Part of the Fuel framework.
  4. *
  5. * @package Fuel
  6. * @version 1.5
  7. * @author Fuel Development Team
  8. * @license MIT License
  9. * @copyright 2010 - 2013 Fuel Development Team
  10. * @link http://fuelphp.com
  11. */
  12. namespace Fuel\Core;
  13. /**
  14. * Lang class tests
  15. *
  16. * @group Core
  17. * @group Lang
  18. */
  19. class Test_Lang extends TestCase
  20. {
  21. /**
  22. * Test for Lang::get()
  23. *
  24. * @test
  25. */
  26. public function test_line()
  27. {
  28. Lang::load('test');
  29. $output = Lang::get('hello', array('name' => 'Bob'));
  30. $expected = 'Hello there Bob!';
  31. $this->assertEquals($expected, $output);
  32. }
  33. /**
  34. * Test for Lang::get()
  35. *
  36. * @test
  37. */
  38. public function test_line_invalid()
  39. {
  40. Lang::load('test');
  41. $output = Lang::get('non_existant_hello', array('name' => 'Bob'));
  42. $expected = false;
  43. $this->assertEquals($expected, $output);
  44. }
  45. /**
  46. * Test for Lang::set()
  47. *
  48. * @test
  49. */
  50. public function test_set_return_true()
  51. {
  52. $output = Lang::set('testing_set_valid', 'Ahoy :name!');
  53. $this->assertNull($output);
  54. }
  55. /**
  56. * Test for Lang::set()
  57. *
  58. * @test
  59. */
  60. public function test_set()
  61. {
  62. Lang::set('testing_set_valid', 'Ahoy :name!');
  63. $output = Lang::get('testing_set_valid', array('name' => 'Bob'));
  64. $expected = 'Ahoy Bob!';
  65. $this->assertEquals($expected, $output);
  66. }
  67. }