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

ADD: Faktory::createMany for bulk-creating factories #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jmwhitworth
Copy link

Added a new static method Faktory::createMany. This allows for multiple factories to be created at once without the need for writing loops within the tests.

I've added basic tests and have updated the readme to include examples. I also made some small changes to the readme for consistency in the use of Faktory vs factory.


Due to the test suite not having a database to write to, I added an argument to determine if the records are saved to the database.

As Faktory::create and Faktory::new are identical with the exception being whether they save to the database, it might be better to implement a Faktory::newMany as a non-saving counterpart. For now, this allowed unit tests to be written despite not being able to mock the required static functions.

@jmwhitworth jmwhitworth force-pushed the add-createMany-method branch from 58fcc6f to df4a420 Compare December 3, 2024 09:40
UPDATE: Added a newMany counterpart to the createMany method

UPDATE: Return of array_map instead of assigning to value

UPDATE: Refactor createMany
@jmwhitworth jmwhitworth force-pushed the add-createMany-method branch from df4a420 to 0a6e794 Compare December 3, 2024 09:49
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 this pull request may close these issues.

1 participant