Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gam6itko opened this issue Dec 8, 2023 · 3 comments

Comments

@gam6itko
Copy link

gam6itko commented Dec 8, 2023

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,
            'Гуляева Розалина Дмитриевна'
        ];
    }
gam6itko added a commit to gam6itko/php-faker that referenced this issue Dec 8, 2023
@gam6itko gam6itko mentioned this issue Dec 8, 2023
7 tasks
@pimjansen
Copy link

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 added a commit to gam6itko/php-faker that referenced this issue Dec 10, 2023
@gam6itko gam6itko mentioned this issue Dec 10, 2023
7 tasks
@gam6itko
Copy link
Author

gam6itko commented Dec 10, 2023

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

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

localheinz pushed a commit that referenced this issue Jan 2, 2024
* fix #832

* review fixes
@gam6itko
Copy link
Author

gam6itko commented Jan 2, 2024

Fixed in #836

@gam6itko gam6itko closed this as completed Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants