themosis / framework

The Themosis framework core.
https://framework.themosis.com/
GNU General Public License v2.0
671 stars 121 forks source link

Build WordPress factories #857

Open jlambe opened 2 years ago

jlambe commented 2 years ago

Build factories for core WordPress models:

ogorzalka commented 2 years ago

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 commented 2 years ago

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.