菜谱项目

InternetTest.php 709B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace Faker\Test\Provider\en_ZA;
  3. use Faker\Generator;
  4. use Faker\Provider\en_ZA\Person;
  5. use Faker\Provider\en_ZA\Internet;
  6. use Faker\Provider\en_ZA\Company;
  7. class InternetTest extends \PHPUnit_Framework_TestCase
  8. {
  9. /**
  10. * @var Generator
  11. */
  12. private $faker;
  13. public function setUp()
  14. {
  15. $faker = new Generator();
  16. $faker->addProvider(new Person($faker));
  17. $faker->addProvider(new Internet($faker));
  18. $faker->addProvider(new Company($faker));
  19. $this->faker = $faker;
  20. }
  21. public function testEmailIsValid()
  22. {
  23. $email = $this->faker->email();
  24. $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
  25. }
  26. }