Ejemplo n.º 1
0
 public function testJournalMalformedRequest()
 {
     $client = new Client();
     $channel = new ControlChannel($client, 'foo');
     $job = new GearmanJob();
     $job->setWorkload(json_encode(array('foo' => 'bar')));
     $json = $channel->process($job);
     $data = json_decode($json, true);
     $this->assertSame('Malformed command received.', $data['error']);
 }
Ejemplo n.º 2
0
 public function testProcessWrongCallback()
 {
     return;
     $client = new Client();
     $channel = new RequestChannel($client);
     $channel->setCallback(function ($request) {
         throw new \Exception("Error Processing Request", 1);
     });
     $job = new GearmanJob();
     $job->setWorkload(TestCase::getResource('Request/GET'));
     $json = $channel->process($job);
     $data = json_decode($json, true);
     $this->assertSame('Error: Error Processing Request', $data['body']);
     $this->assertSame(500, $data['responseCode']);
 }