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


PHP Generator::name方法代码示例

本文整理汇总了PHP中Faker\Generator::name方法的典型用法代码示例。如果您正苦于以下问题:PHP Generator::name方法的具体用法?PHP Generator::name怎么用?PHP Generator::name使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Faker\Generator的用法示例。


在下文中一共展示了Generator::name方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testNameReturnsFirstNameAndLastName

 public function testNameReturnsFirstNameAndLastName()
 {
     $faker = new Generator();
     $faker->addProvider(new Person($faker));
     $this->assertContains($faker->name(), array('John Doe', 'Jane Doe'));
     $this->assertContains($faker->name('foobar'), array('John Doe', 'Jane Doe'));
     $this->assertContains($faker->name('male'), array('John Doe'));
     $this->assertContains($faker->name('female'), array('Jane Doe'));
 }
开发者ID:saj696,项目名称:pipe,代码行数:9,代码来源:PersonTest.php

示例2: generateReference

 /**
  * Generates a student convention reference from the student full name and the date of signature of the convention.
  *
  * @param \DateTime   $dateOfSignature
  * @param string|null $fullname        If is null, a random name is used instead
  *
  * @return string
  */
 public function generateReference(\DateTime $dateOfSignature, $fullname = null)
 {
     if (null === $fullname || '' === $fullname) {
         // It does not matter if the Faker instance is not based on the application locale as we don't really
         // care of the real value of the name. Keeping this avoid having to inject a faker instance which is
         // more difficul to properly test.
         $fullname = $this->faker->name();
     }
     $fullnameParts = array_merge(explode(' ', $this->normalizeString($fullname)), ['a', 'b', 'c', 'd', 'e', 'f']);
     $reference = '';
     foreach ($fullnameParts as $part) {
         $referenceLength = strlen($reference);
         if (6 === $referenceLength) {
             break;
         }
         $remaining = 6 - $referenceLength;
         if (3 < $remaining) {
             $remaining = 3;
         }
         $reference .= substr($part, 0, $remaining);
     }
     $reference .= $dateOfSignature->format('Ymd');
     return strtoupper($reference);
 }
开发者ID:EllynB,项目名称:Incipio,代码行数:32,代码来源:StudentConventionProvider.php

示例3: getDummyData

 public function getDummyData(Generator $faker, array $customValues = array())
 {
     return ['comunidad' => $faker->company, 'tipo_secretariado_id' => rand(1, 3), 'responsable' => $faker->name($gender = null | 'male' | 'female'), 'direccion' => $faker->randomElement(['Numancia, 22', 'Escaleritas, 128', 'Carvajal, 32']), 'cp' => $faker->randomElement(['35012', '35016', '35018', '35010', '32012']), 'pais_id' => 73, 'provincia_id' => 1, 'localidad_id' => $faker->biasedNumberBetween($min = 1, $max = 34, $function = 'sqrt'), 'email_solicitud' => $faker->email, 'email_envio' => $faker->email, 'web' => $faker->url, 'facebook' => $faker->url, 'telefono1' => $faker->randomElement(['615324789', '928276589', '627456896', '615856912']), 'telefono2' => $faker->randomElement(['', '', '928278956', '928564285']), 'tipo_comunicacion_preferida_id' => rand(1, 2), 'observaciones' => $faker->text($maxNbChars = 200)];
 }
开发者ID:antoniobec,项目名称:palencia,代码行数:4,代码来源:ComunidadesTableSeeder.php


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