Skip to content
This repository was archived by the owner on Dec 11, 2020. It is now read-only.

Commit 8d16af3

Browse files
committed
Fix lastName should generate random gender
1 parent c6d03aa commit 8d16af3

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Faker/Provider/ru_RU/Person.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ class Person extends \Faker\Provider\Person
105105
'Меркушев', 'Лыткин', 'Туров',
106106
);
107107

108+
protected static $lastNameSuffix = array('a', '');
109+
108110
/**
109111
* Return male middle name
110112
*
@@ -166,11 +168,13 @@ public function middleName($gender = null)
166168
public function lastName($gender = null)
167169
{
168170
$lastName = static::randomElement(static::$lastName);
169-
171+
170172
if (static::GENDER_FEMALE === $gender) {
171173
return $lastName . 'a';
174+
} elseif (static::GENDER_MALE === $gender) {
175+
return $lastName;
172176
}
173-
174-
return $lastName;
177+
178+
return $lastName . static::randomElement(static::$lastNameSuffix);
175179
}
176180
}

test/Faker/Provider/ru_RU/PersonTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ public function testLastNameFemale()
2727

2828
public function testLastNameMale()
2929
{
30-
$this->assertNotEquals("a", substr($this->faker->lastName(), -1));
30+
$this->assertNotEquals("a", substr($this->faker->lastName('male'), -1));
3131
}
3232
}

0 commit comments

Comments
 (0)