FakerPHP / Faker

Faker is a PHP library that generates fake data for you

Home Page:https://fakerphp.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[ru_RU/PersonProvider] Double `а` in female lastName when using the `name()` function

gam6itko opened this issue · comments

Summary

Versions

Version
PHP 8.3
fakerphp/faker v1.23.0

Self-enclosed code snippet for reproduction

 $generator = Factory::create('ru_RU');
 $generator->seed(1917);
 self::assertSame('Павлова Нонна Александровна', $generator->name('female')); // this fails

image

TestCase

 /**
     * @dataProvider dataIssue832
     */
    public function testIssue832(int $seed, string $expected): void
    {
        $generator = new Generator();
        $generator->seed($seed);

        foreach ($this->getProviders() as $provider) {
            $generator->addProvider($provider);
        }

        self::assertSame($expected, $generator->name('female'));
    }

    public static function dataIssue832(): iterable
    {
        //bad cases
        yield 'seed: 55' => [
            55,
            'Ларионова Алина Ивановна'
        ];
        yield 'seed: 512' => [
            512,
            'Тихонова Владлена Львовна'
        ];
        yield 'seed: 625' => [
            625,
            'Ларионова Нонна Максимовна'
        ];
        yield 'seed: 1917' => [
            1917,
            'Павлова Нонна Александровна'
        ];

        //good cases
        yield 'seed: 4' => [
            4,
            'Фаина Фёдоровна Романоваа'
        ];
        yield 'seed: 8' => [
            8,
            'Яна Александровна Жукова'
        ];
        yield 'seed: 42' => [
            42,
            'Гуляева Розалина Дмитриевна'
        ];
    }

There is only an assumption that a seed will return the same value on the same version of the code on the same server etc.

If you call the name twice while seeding, are you receiving the same outcome?

If you call the name twice while seeding, are you receiving the same outcome?

No, subsequent calls of methods will return a different result.