cakephp-fixture-factories icon indicating copy to clipboard operation
cakephp-fixture-factories copied to clipboard

Add a way to define a seed for faker

Open pakacuda opened this issue 4 years ago • 1 comments

It could be done dynamically on a 'per test' basis in the setUp method of a phpunit test case Or maybe through a config file. Using this method would seed the whole test suite. Will have to see which option is the best suited. I would go for the first one alogside a 'default' seed

pakacuda avatar May 06 '20 20:05 pakacuda

To add a faker seed at the factory level with a setFakerSeed native method? You would have: $article = ArticleFactory::make()->setFakerSeed(123) I think it is then the role of the developer to define a $SeededArticleFactory in setUp() to be reused in each test. That is the way I would solve the problem.

pabloelcolombiano avatar May 07 '20 14:05 pabloelcolombiano