本文整理汇总了PHP中Faker\Generator::email方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::email方法的具体用法?PHP Generator::email怎么用?PHP Generator::email使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Faker\Generator
的用法示例。
在下文中一共展示了Generator::email方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testEmailIsValid
public function testEmailIsValid()
{
$email = $this->faker->email();
$this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
$this->assertNotEmpty($email);
$this->assertInternalType('string', $email);
}
示例2: testEmailIsValid
/**
* @link http://stackoverflow.com/questions/12026842/how-to-validate-an-email-address-in-php
*
* @requires PHP 5.4
* @dataProvider localeDataProvider
*/
public function testEmailIsValid($locale)
{
$this->loadLocalProviders($locale);
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD';
$emailAddress = $this->faker->email();
$this->assertRegExp($pattern, $emailAddress);
}
示例3: fillUser
protected function fillUser(User $u)
{
$u->gender = $this->faker->randomElement(Gender::getGenders());
$u->setNominativeAndVocative($this->faker->firstName($u->gender));
$u->familyName = $this->faker->lastName($u->gender);
$u->name = "{$u->nominative} {$u->familyName}";
$u->email = $this->faker->email($u->nominative, $u->familyName);
}
示例4: testEmailIsValid
public function testEmailIsValid()
{
$email = $this->faker->email();
$this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
}