예제 #1
0
 public function testSend()
 {
     try {
         $connection = Connection::connect();
     } catch (\Net\Gearman\Exception $exception) {
         return $this->markTestSkipped('Skipped. You can try this test on your machine with gearman running.');
     }
     Connection::send($connection, 'echo_req', array('text' => 'foobar'));
     do {
         $ret = Connection::read($connection);
     } while (is_array($ret) && !count($ret));
     Connection::close($connection);
     $this->assertInternalType('array', $ret);
     $this->assertEquals('echo_res', $ret['function']);
     $this->assertEquals(17, $ret['type']);
     $this->assertInternalType('array', $ret['data']);
     $this->assertEquals('foobar', $ret['data']['text']);
 }
예제 #2
0
 public function endWork()
 {
     foreach ($this->connection as $conn) {
         Connection::close($conn);
     }
 }