When run in Client mode it will allow adding new jobs to the Queue. When run in worker mode it will execute jobs on the Queue. Worker mode also allows adding new jobs to the queue just like Mlient mode.
コード例 #1
0
ファイル: wp-gears-runner.php プロジェクト: 10up/wp-gears
function wp_gears_runner()
{
    wp_gears_autoloader();
    $plugin = \WpGears\Plugin::get_instance();
    $plugin->enable();
    return $plugin->run();
}
コード例 #2
0
ファイル: wp-gears.php プロジェクト: 10up/wp-gears
function wp_async_task_init()
{
    wp_gears_autoloader();
    $plugin = \WpGears\Plugin::get_instance();
    $plugin->enable();
    $GLOBALS['wp_async_task'] = $plugin;
}
コード例 #3
0
ファイル: WpGearsTest.php プロジェクト: 10up/wp-gears
 function test_it_can_add_job_to_client_object()
 {
     $mock = \Mockery::mock()->shouldReceive('register')->atMost(1)->shouldReceive('addServer')->atMost(1)->andReturn(true)->shouldReceive('add')->with('action_b', array(1, 2, 3), 'low')->once()->andReturn(true)->getMock();
     $plugin = \WpGears\Plugin::get_instance();
     $plugin->config_prefix = 'C' . uniqid();
     $plugin->client = $mock;
     $actual = wp_async_task_add('action_b', array(1, 2, 3), 'low');
     $this->assertTrue($actual);
 }
コード例 #4
0
ファイル: WpGearsRunnerTest.php プロジェクト: 10up/wp-gears
 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);
 }