StrTest.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. class StrTest extends PHPUnit_Framework_TestCase {
  3. public function test_lower()
  4. {
  5. $this->assertEquals('something', Laravel\Str::lower('SomeThing'));
  6. $this->assertEquals('τάχιστη', Laravel\Str::lower('ΤΆΧΙΣΤΗ'));
  7. }
  8. public function test_upper()
  9. {
  10. $this->assertEquals('SPEAK LOUDER', Laravel\Str::upper('speak louder'));
  11. $this->assertEquals('ΤΆΧΙΣΤΗ', Laravel\Str::upper('Τάχιστη'));
  12. }
  13. public function test_title()
  14. {
  15. $this->assertEquals('This Is A Test', Laravel\Str::title('this is a test'));
  16. $this->assertEquals('Τάχιστη Τάχιστη', Laravel\Str::title('τάχιστη τάχιστη'));
  17. }
  18. public function test_length()
  19. {
  20. $this->assertEquals(4, Laravel\Str::length('four'));
  21. $this->assertEquals(7, Laravel\Str::length('τάχιστη'));
  22. }
  23. public function test_ascii()
  24. {
  25. $this->assertEquals('Deuxieme Article', Laravel\Str::ascii('Deuxième Article'));
  26. }
  27. public function test_random()
  28. {
  29. $this->assertEquals(5, strlen(Laravel\Str::random(5)));
  30. }
  31. }