FakerPHP / Faker

Faker is a PHP library that generates fake data for you
https://fakerphp.github.io
Other
3.47k stars 331 forks source link

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

Closed gam6itko closed 6 months ago

gam6itko commented 6 months ago

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,
            'Гуляева Розалина Дмитриевна'
        ];
    }
pimjansen commented 6 months ago

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?

gam6itko commented 6 months ago

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

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

gam6itko commented 6 months ago

Fixed in #836