LangTest.php 822 B

12345678910111213141516171819202122232425262728
  1. <?php use Laravel\Lang;
  2. class LangTest extends PHPUnit_Framework_TestCase {
  3. public function test_simple_language_lines_can_be_retrieved()
  4. {
  5. $language = require LANG_PATH.'en/validation.php';
  6. $this->assertEquals($language['required'], Lang::line('validation.required')->get());
  7. }
  8. public function test_default_value_is_returned_when_line_doesnt_exist()
  9. {
  10. $language = require LANG_PATH.'en/validation.php';
  11. $this->assertEquals('Taylor', Lang::line('validation.something')->get(null, 'Taylor'));
  12. }
  13. public function test_replacements_can_be_made_on_language_lines()
  14. {
  15. $language = require LANG_PATH.'en/validation.php';
  16. $expect = str_replace(':attribute', 'E-Mail', $language['required']);
  17. $this->assertEquals($expect, Lang::line('validation.required', array('attribute' => 'E-Mail'))->get());
  18. }
  19. }