assertArrayHasKey( 'wc_admin_disabled', $tracking_data ); $this->assertEquals( 'no', $tracking_data['wc_admin_disabled'] ); // Test the case for woocommerce_admin_disabled filter returning true. add_filter( 'wc_admin_disabled', $this->disable_woocommerce_admin() ); // Bypass the 1h cooldown period so we can invoke send_tracking_data again. add_filter( 'woocommerce_tracker_last_send_time', function( $time ) { return $time - 10000; } ); WC_Tracker::send_tracking_data( true ); $tracking_data_disabled_wc_admin = json_decode( $posted_data['body'], true ); $this->assertArrayHasKey( 'wc_admin_disabled', $tracking_data_disabled_wc_admin ); $this->assertEquals( 'yes', $tracking_data['wc_admin_disabled'] ); remove_filter( 'wc_admin_disabled', $this->disable_woocommerce_admin() ); } }