当前位置: 首页>>代码示例>>PHP>>正文


PHP Generator::email方法代码示例

本文整理汇总了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);
 }
开发者ID:fzaninotto,项目名称:faker,代码行数:7,代码来源:InternetTest.php

示例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);
 }
开发者ID:Kingsmanscode,项目名称:blog,代码行数:13,代码来源:InternetTest.php

示例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);
 }
开发者ID:VasekPurchart,项目名称:khanovaskola-v3,代码行数:8,代码来源:Fake.php

示例4: testEmailIsValid

 public function testEmailIsValid()
 {
     $email = $this->faker->email();
     $this->assertNotFalse(filter_var($email, FILTER_VALIDATE_EMAIL));
 }
开发者ID:edwardricardo,项目名称:zenska,代码行数:5,代码来源:InternetTest.php


注:本文中的Faker\Generator::email方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。