Esempio n. 1
0
 /**
  * @dataProvider provideCallbackData
  */
 public function testPackUnpackMessage($methodName, array $methodArgs)
 {
     $response = $this->getMock('Tarantool\\Response', [], [], '', false);
     $this->packer->expects($this->once())->method('pack')->with($this->isInstanceOf('Tarantool\\Request\\Request'))->will($this->returnValue($this->isType('string')));
     $this->packer->expects($this->once())->method('unpack')->will($this->returnValue($response));
     $response = call_user_func_array([$this->client, $methodName], $methodArgs);
     $this->assertResponse($response);
 }
Esempio n. 2
0
 /**
  * @expectedException \Tarantool\Exception\Exception
  * @expectedExceptionMessage foo.
  */
 public function testThrowExceptionOnIProtoError()
 {
     $header = pack('CCCnCC', 0x82, IProto::CODE, 0xcd, Request::TYPE_ERROR, IProto::SYNC, 0);
     $body = pack('C*', 0x81, IProto::ERROR, 0xa0 | 4) . 'foo.';
     $this->packer->unpack($header . $body);
 }