function test_it_will_execute_a_job_on_run() { $mock = \Mockery::mock()->shouldReceive('register')->andReturn(true)->shouldReceive('work')->with()->once()->andReturn(true)->getMock(); $plugin = \WpGears\Plugin::get_instance(); $plugin->config_prefix = 'B' . uniqid(); $plugin->worker = $mock; $actual = wp_gears_runner(); $this->assertEquals(0, $actual); }
{ if (file_exists(__DIR__ . '/autoload.php')) { return __DIR__ . '/autoload.php'; } else { if (file_exists(__DIR__ . '/wp-content/plugins/wp-gears/autoload.php')) { return __DIR__ . '/wp-content/plugins/wp-gears/autoload.php'; } else { if (defined('WP_GEARS_DIR')) { return WP_GEARS_DIR . '/autoload.php'; } else { error_log('WP Gears Fatal Error - Cannot find autoload.php'); return false; } } } } if (!defined('PHPUNIT_RUNNER')) { ignore_user_abort(true); if (!empty($_POST) || defined('DOING_AJAX') || defined('DOING_ASYNC')) { die; } define('DOING_ASYNC', true); if (!defined('ABSPATH')) { /** Set up WordPress environment - using SCRIPT_FILENAME so that this file works even if its a symlink! */ if (!file_exists(dirname($_SERVER["SCRIPT_FILENAME"]) . '/wp-load.php')) { error_log('WP Gears Fatal Error - Cannot find wp-load.php'); } require_once dirname($_SERVER["SCRIPT_FILENAME"]) . '/wp-load.php'; } wp_gears_runner(); }