Пример #1
0
 public function testSimpleClient()
 {
     /** @var ZMQSocket $socketDealer */
     $socketDealer = $this->getMockBuilder('ZMQSocket')->disableOriginalConstructor()->getMock();
     $queue = new Client($socketDealer);
     $socketDealer->expects($this->any())->method('recv')->will($this->returnValue('command'));
     $queue->setSocket('tcp://127.0.0.1:4444');
     $queue->run("command");
     $this->assertEquals('command', $queue->getOutput());
 }
Пример #2
0
<?php

include __DIR__ . '/../vendor/autoload.php';
use Zmqlifo\Client;
$queue = Client::factory('tcp://127.0.0.1:4444');
echo $queue->run("ls -latr")->getOutput();
echo $queue->run("pwd")->getOutput();