Giter Club home page Giter Club logo

Comments (4)

stale avatar stale commented on September 25, 2024

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 1 week if no further activity occurs. Thank you for your contributions.

from faker.

pimjansen avatar pimjansen commented on September 25, 2024

@localheinz also noticed we could use the unique generator to exhaust the resource pool. Problem is that this will consume a lot of RAM though.

Im not a fan of just looping hundreds of times. I fact we know for sure we can not guarantee this 100% at this point however also the risk of issues is pretty low right?

from faker.

localheinz avatar localheinz commented on September 25, 2024

@IonBazan

Any test that tests that asserts that a provider, given a specific seed of the generator, returns a specific value is bound to fail when the randomization engine changes - see #691, for example.

The question is, what are we going to do when the randomization engine changes? Fix all the failing tests by adjusting the expectations? Seems painful.

For example, I do not see any value in asserting that $faker->email() returns a specific email address. I would not recommend to anyone using fakerphp/faker to rely on $faker->email() to return a specific value. All that should matter to them is that the returned value is semantically correct, that is, that the returned value is an email address.

On a separate note, the --repeat option has been removed from phpunit/phpunit:10.0.0.

from faker.

curry684 avatar curry684 commented on September 25, 2024

You should differentiate between what you are testing for in a library like this. Because indeed:

For example, I do not see any value in asserting that $faker->email() returns a specific email address.

Not just no value, it's downright wrong to test like that, as you are testing something that, when it fails, does not imply anything is wrong with the code. If it returns [email protected] today and [email protected] tomorrow the code is still working fine - it returned an email address. The only proper test for the email function is $this->assertSame($email, filter_var($email, VALIDATE_EMAIL));

It does however make sense to test repeatable seeded determinism. email is NOT required to always return the same email address between runs, on different computers or operating systems. It is however required to return same email address when run with the same seed in the same run in the same environment. So yes, it does make sense to get a random seed value during testing and use that to test repeated calls.

from faker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.