function test_it_can_initialize_the_plugin() { wp_async_task_init(); $plugin = \WpGears\Plugin::get_instance(); $this->assertTrue($plugin->did_enable); }
/** * Adds a single async task to the gearman job queue. * * @param string $hook The action that will be called when running this job. * @param array $args An array of args that should be passed to the callback when the action hook is called. * @param string $priority Priority of the job (low, normal, high). Default normal. * * @since 0.1 */ function wp_async_task_add($hook, $args = array(), $priority = 'normal') { $plugin = \WpGears\Plugin::get_instance(); return $plugin->add($hook, $args, $priority); } function wp_async_task_init() { wp_gears_autoloader(); $plugin = \WpGears\Plugin::get_instance(); $plugin->enable(); $GLOBALS['wp_async_task'] = $plugin; } add_action('plugins_loaded', function () { global $wp_async_task; if (class_exists('Debug_Bar_Extender')) { Debug_Bar_Extender::instance()->trace_var($wp_async_task); } }); // Init if (!defined('PHPUNIT_RUNNER')) { wp_async_task_init(); }