Exemplo n.º 1
0
 public function testAppendingParams()
 {
     $this->serializer->expects($this->once())->method('serialize')->with('methodName', array('p0', 'p1', 'p2', 'p3'))->will($this->returnValue('REQUEST'));
     $this->mockTransport('http://foo.com', 'REQUEST', 'RESPONSE');
     $this->parser->expects($this->once())->method('parse')->with('RESPONSE')->will($this->returnValue('NATIVE VALUE'));
     $this->assertSame(array(), $this->client->getAppendParams());
     $this->client->appendParams(array('p2', 'p3'));
     $this->assertSame(array('p2', 'p3'), $this->client->getAppendParams());
     $this->assertSame('NATIVE VALUE', $this->client->call('methodName', array('p0', 'p1')));
 }
Exemplo n.º 2
0
 /** {@inheritdoc} */
 public function call($methodName, array $params = [])
 {
     if (!is_string($methodName)) {
         throw InvalidArgumentException::expectedParameter(0, 'string', $methodName);
     }
     $params = array_merge($this->prependParams, $params, $this->appendParams);
     $payload = $this->serializer->serialize($methodName, $params);
     $response = $this->transport->send($this->uri, $payload);
     return $this->parser->parse($response);
 }
Exemplo n.º 3
0
 public function testSerialeArray()
 {
     $xml = '<?xml version="1.0" encoding="UTF-8"?>
         <methodCall>
             <methodName>method</methodName>
             <params>
                 <param>
                     <value>
                         <struct>
                             <member>
                                 <name>_FCGI_</name>
                             <value>
                                 <string>some value</string>
                             </value>
                         </member>
                     </struct>
                 </value>
             </param>
         </params>
     </methodCall>';
     $this->assertXmlStringEqualsXmlString($xml, $this->serializer->serialize('method', [['_FCGI_' => 'some value']]));
 }