-
Notifications
You must be signed in to change notification settings - Fork 363
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
Use seed() in tests? #82
Comments
Good point - I've noticed some inconsistency there too. What do you think about putting it in $this->faker = new Generator();
$this->faker->seed(1); While we are here, we could replace the second argument for Lines 217 to 224 in 6366793
But that would be a breaking change. |
Agree on the default seed set in the setup. The MTRand for now is fine. Lets bump that in 2.x |
The downside of seeding the random number generator for all tests would of course be that our tests would miss cases that only occur sometimes/randomly. |
Closing this since we updated the seeding used in setup. If changes are still required feel free to raise a pr fornthis |
I'd like to increase the Provider test coverage a bit. To do so I checked out the existing tests and saw different approaches taken:
some tests use seed() to ensure a certain result is returned, e.g.
Faker/test/Faker/Provider/uk_UA/PersonTest.php
Lines 11 to 18 in 907b307
other tests just check that a non-empty result is returned, e.g.
Faker/test/Faker/Provider/bn_BD/PersonTest.php
Lines 18 to 22 in 907b307
Another approach would be to test that we're dealing with a valid string (in the case of
firstNameMale()
) or via regex a valid pattern.Is there another solution I have overlooked/any other ideas? Which solution do you prefer?
The text was updated successfully, but these errors were encountered: