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

Implement a BaseFactory class #129

Closed
chx2 opened this issue Apr 15, 2021 · 4 comments
Closed

Implement a BaseFactory class #129

chx2 opened this issue Apr 15, 2021 · 4 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@chx2
Copy link
Contributor

chx2 commented Apr 15, 2021

In TIPOFF/locations#110, it was rather helpful to create a factory state to better improve the data that a given factory could generate in addition to making it easier to browser test the creation of resources.

Referring to how tipoff packages tend to have simliar fields such as creator_id and updater_id for example, it may be beneficial to have a BaseFactory class that would extend Illuminate\Database\Eloquent\Factories\Factory. Once extended into a package model factory, definition could be called as normal but factories would then be able to have access to states visible in the BaseFactory that could be chained for use wherever needed.

@chx2 chx2 added enhancement New feature or request question Further information is requested labels Apr 15, 2021
@drewroberts
Copy link
Member

@pdbreen What are your thoughts on this? Should @chx2 go ahead and create a draft PR for what he has in mind?

@pdbreen
Copy link
Contributor

pdbreen commented Apr 15, 2021

doesn't seem worth it to me - not sure what (meaningful) states would be common across different models

edit: here's an example of a factory with a bunch of states -- https://github.com/tipoff/vouchers/blob/main/database/factories/VoucherFactory.php -- but none of these are relevant to any other model.

@chx2
Copy link
Contributor Author

chx2 commented Apr 15, 2021

That makes sense. For now I will keep use of factory states per package basis.

@drewroberts
Copy link
Member

Thank you both. @chx2 Keep creating issues like this and posting ideas to improve the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants