themosis / framework

The Themosis framework core.

Home Page:https://framework.themosis.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build WordPress factories

jlambe opened this issue · comments

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

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)

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.