示例#1
0
 public function testCommands()
 {
     $this->markTestSkipped('Requires a running Gearman server, unless a better approach is available');
     $gearmanAdmin = new GearmanAdmin();
     $version = $gearmanAdmin->version();
     $this->assertInternalType('string', $version);
     $this->assertTrue(false !== $gearmanAdmin->status());
     $this->assertTrue(false !== $gearmanAdmin->workers());
     $this->assertTrue($gearmanAdmin->maxQueue('test'));
     $this->assertEmpty($gearmanAdmin->getLastError());
     $this->assertTrue($gearmanAdmin->shutdown());
     $this->assertFalse($gearmanAdmin->version());
 }
示例#2
0
<?php

/**
 * This file is part of the php-gearman-admin framework.
 * @link https://github.com/Ibmurai/php-gearman-admin
 *
 * Examine the API to obtain more precise information.
 *
 * Example: Getting the number of available workers for a given function:
 *
 * <?php
 * $admin = new GearmanAdmin();
 * echo $admin->getStatus()->getAvailable('somefunction');
 * ?>
 *
 * @copyright Copyright 2012 Jens Riisom Schultz
 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
 */
require dirname(__FILE__) . '/GearmanAdmin.php';
$admin = new GearmanAdmin();
echo 'gearman version: ' . $admin->getVersion() . "\n";
echo $admin->getStatus();
echo $admin->getWorkers();