radarrplexorganizrnginxsonarrdashboardsabnzbdheimdallembycouchpotatonzbgetbookmarkapplication-dashboardmuximuxlandingpagestartpagelandinghtpcserverhomepage
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.5 KiB
87 lines
2.5 KiB
<?php
|
|
|
|
namespace Faker\Test\Provider;
|
|
|
|
use Faker\Provider\Person;
|
|
use Faker\Generator;
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
class PersonTest extends TestCase
|
|
{
|
|
/**
|
|
* @dataProvider firstNameProvider
|
|
*/
|
|
public function testFirstName($gender, $expected)
|
|
{
|
|
$faker = new Generator();
|
|
$faker->addProvider(new Person($faker));
|
|
$this->assertContains($faker->firstName($gender), $expected);
|
|
}
|
|
|
|
public function firstNameProvider()
|
|
{
|
|
return array(
|
|
array(null, array('John', 'Jane')),
|
|
array('foobar', array('John', 'Jane')),
|
|
array('male', array('John')),
|
|
array('female', array('Jane')),
|
|
);
|
|
}
|
|
|
|
public function testFirstNameMale()
|
|
{
|
|
$this->assertContains(Person::firstNameMale(), array('John'));
|
|
}
|
|
|
|
public function testFirstNameFemale()
|
|
{
|
|
$this->assertContains(Person::firstNameFemale(), array('Jane'));
|
|
}
|
|
|
|
/**
|
|
* @dataProvider titleProvider
|
|
*/
|
|
public function testTitle($gender, $expected)
|
|
{
|
|
$faker = new Generator();
|
|
$faker->addProvider(new Person($faker));
|
|
$this->assertContains($faker->title($gender), $expected);
|
|
}
|
|
|
|
public function titleProvider()
|
|
{
|
|
return array(
|
|
array(null, array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')),
|
|
array('foobar', array('Mr.', 'Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')),
|
|
array('male', array('Mr.', 'Dr.', 'Prof.')),
|
|
array('female', array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.')),
|
|
);
|
|
}
|
|
|
|
public function testTitleMale()
|
|
{
|
|
$this->assertContains(Person::titleMale(), array('Mr.', 'Dr.', 'Prof.'));
|
|
}
|
|
|
|
public function testTitleFemale()
|
|
{
|
|
$this->assertContains(Person::titleFemale(), array('Mrs.', 'Ms.', 'Miss', 'Dr.', 'Prof.'));
|
|
}
|
|
|
|
public function testLastNameReturnsDoe()
|
|
{
|
|
$faker = new Generator();
|
|
$faker->addProvider(new Person($faker));
|
|
$this->assertEquals($faker->lastName(), 'Doe');
|
|
}
|
|
|
|
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'));
|
|
}
|
|
}
|
|
|