public function call(Request $request) { $this->connect(); $commandString = $request->buildRequest(); $this->write($commandString); $raw = $this->read(); $response = $this->parseResponse($raw); return $response; }
/** * @depends testSetCommand * @depends testGetCommand * @covers Versionable\Ration\Request\Request::buildRequest * @covers Versionable\Ration\Request\Request::setCommand * @covers Versionable\Ration\Request\Request::getCommand */ public function testBuildRequest() { $crlf = chr(13) . chr(10); $request = '*1' . $crlf . '$4' . $crlf . 'TEST' . $crlf; $command = $this->getMock('CommandInterface', array('getParameters', 'getCommand')); $command->expects($this->once())->method('getParameters')->will($this->returnValue(array())); $command->expects($this->once())->method('getCommand')->will($this->returnValue('test')); $this->object->setCommand($command); $this->assertEquals($request, $this->object->buildRequest()); }