You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 line
1.2KB

  1. <?php
  2. namespace Faker\Test\Provider;
  3. use Faker\Provider\Miscellaneous;
  4. class MiscellaneousTest extends \PHPUnit_Framework_TestCase
  5. {
  6. public function testBoolean()
  7. {
  8. $this->assertContains(Miscellaneous::boolean(), array(true, false));
  9. }
  10. public function testMd5()
  11. {
  12. $this->assertRegExp('/^[a-z0-9]{32}$/', Miscellaneous::md5());
  13. }
  14. public function testSha1()
  15. {
  16. $this->assertRegExp('/^[a-z0-9]{40}$/', Miscellaneous::sha1());
  17. }
  18. public function testSha256()
  19. {
  20. $this->assertRegExp('/^[a-z0-9]{64}$/', Miscellaneous::sha256());
  21. }
  22. public function testLocale()
  23. {
  24. $this->assertRegExp('/^[a-z]{2,3}_[A-Z]{2}$/', Miscellaneous::locale());
  25. }
  26. public function testCountryCode()
  27. {
  28. $this->assertRegExp('/^[A-Z]{2}$/', Miscellaneous::countryCode());
  29. }
  30. public function testCountryISOAlpha3()
  31. {
  32. $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::countryISOAlpha3());
  33. }
  34. public function testLanguage()
  35. {
  36. $this->assertRegExp('/^[a-z]{2}$/', Miscellaneous::languageCode());
  37. }
  38. public function testCurrencyCode()
  39. {
  40. $this->assertRegExp('/^[A-Z]{3}$/', Miscellaneous::currencyCode());
  41. }
  42. }