Yes, this is true because WooCommerce cart is only initialized on the front-end (or if it's a front-end request):
But it fails because $woocommerce->cart is always null.
So in WooCommerce 3.6.4 (current release as of writing) or later, you can manually initialize the cart like so:
// Load cart functions which are loaded only on the front-end.
Your logic for your updated if statement is wrong.
if( !is_wp_error($response) && $response['response']['code'] != 200 )
Here you are saying; if NOT wp_error AND response code NOT 200 return false. So your not actually catching the WP_Error
I believe what you are after is something like:
if ( is_wp_error($response) || $response['response']['code']...
category__in is used for built-in post categories, not for custom taxonomies.
You can try something like this:
$args = array(
'post_type' => 'tribe_events',
'meta_query' => array(
'key' => '_EventStartDate',
'value' => array( $start_date, $end_date ),
'compare' => 'BETWEEN',
I like the idea of running this through a schedule event in WordPress, https://codex.wordpress.org/Function_Reference/wp_schedule_event
Here is a snippet that hopefully will get you there:
wp_schedule_event( time(), 'daily', 'daily_plugin_check' );
add_action( 'daily_plugin_check', '...
Testing of WP plugins and themes with phpunit is absolutely proper and widely used. You can see an example of pure phpunit tests in our plugin Cyr2Lat (please look at test folder).
What you can find there, it is an example of pure phpunit tests, which work with testing class only and mock everything other.
Tests based on WP_UnitTestCase we call "...