No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

TextTest.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. namespace Faker\Test\Provider;
  3. use Faker\Provider\en_US\Text;
  4. use Faker\Generator;
  5. class TextTest extends \PHPUnit_Framework_TestCase
  6. {
  7. public function testTextMaxLength()
  8. {
  9. $generator = new Generator();
  10. $generator->addProvider(new Text($generator));
  11. $generator->seed(0);
  12. $lengths = array(10, 20, 50, 70, 90, 120, 150, 200, 500);
  13. foreach ($lengths as $length) {
  14. $this->assertLessThan($length, $generator->realText($length));
  15. }
  16. }
  17. /**
  18. * @expectedException \InvalidArgumentException
  19. */
  20. public function testTextMaxIndex()
  21. {
  22. $generator = new Generator();
  23. $generator->addProvider(new Text($generator));
  24. $generator->seed(0);
  25. $generator->realText(200, 11);
  26. }
  27. /**
  28. * @expectedException \InvalidArgumentException
  29. */
  30. public function testTextMinIndex()
  31. {
  32. $generator = new Generator();
  33. $generator->addProvider(new Text($generator));
  34. $generator->seed(0);
  35. $generator->realText(200, 0);
  36. }
  37. /**
  38. * @expectedException \InvalidArgumentException
  39. */
  40. public function testTextMinLength()
  41. {
  42. $generator = new Generator();
  43. $generator->addProvider(new Text($generator));
  44. $generator->seed(0);
  45. $generator->realText(9);
  46. }
  47. }