Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Build WordPress factories #857

Open
12 tasks
jlambe opened this issue May 15, 2022 · 2 comments
Open
12 tasks

Build WordPress factories #857

jlambe opened this issue May 15, 2022 · 2 comments
Assignees
Milestone

Comments

@jlambe
Copy link
Contributor

jlambe commented May 15, 2022

Build factories for core WordPress models:

  • Post factory
  • Post meta factory
  • User factory
  • User meta factory
  • Comment factory
  • Comment meta factory
  • Site factory
  • Site meta factory
  • Taxonomy factory
  • Terms factory
  • Term meta factory
  • Options factory
@jlambe jlambe self-assigned this May 15, 2022
@ogorzalka
Copy link
Contributor

What about Corcel ? We used it on several project and it works good. The only bad thing is that it create an extra db connection

We created an extra project based on Corcel which use the $wpdb global not to use an extra connection but it doesn't support table creation via the Schema class (https://github.com/AmphiBee/wordpress-eloquent-models)

@jlambe
Copy link
Contributor Author

jlambe commented May 16, 2022

I'm aware of the Corcel project...

What I have in mind here is more to provide utility classes for unit testing that hook into WordPress core functions like wp_insert_post() for example.

Because using Eloquent does not trigger the WordPress "side effects" like filters or actions. A code feature from your application may rely on specific hook to trigger and this is something you can't have with Corcel or similar projects for example.

Those factories classes can eventually also be used to insert a new record for sure.

@jlambe jlambe added this to the 4.0 milestone May 31, 2022
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants