Example #1
0
 public function testProcess()
 {
     $client = new Client();
     $channel = new RequestChannel($client);
     $channel->setCallback(function ($request) {
         header('Foo: bar', true, 404);
         return $request->getRequestUrl();
     });
     $job = new GearmanJob();
     $job->setWorkload(TestCase::getResource('Request/GET'));
     $json = $channel->process($job);
     $data = json_decode($json, true);
     $this->assertSame('/filename.html', $data['body']);
     $this->assertSame('bar', $data['headers']['Foo']);
     $this->assertSame(404, $data['responseCode']);
     $this->assertTrue(0 < $client->getTime());
 }