public function testPrependingDetaultParams() { $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->getPrependParams()); $this->client->prependParams(array('p0', 'p1')); $this->assertSame(array('p0', 'p1'), $this->client->getPrependParams()); $this->assertSame('NATIVE VALUE', $this->client->call('methodName', array('p2', 'p3'))); }
/** * @inheritdoc */ function invalidateSession($sessionId) { $this->client->prependParams(array($sessionId)); try { $result = $this->client->call('ox.logoff', array()); if ($result !== true) { throw new \InvalidArgumentException(); } } catch (\fXmlRpc\Exception\FaultException $e) { if ($e->getFaultCode()) { throw new \InvalidArgumentException("Invalid sessionId"); } throw new RepositoryInfrastructureException("Infrastructure exception.", 0, $e); } catch (\fXmlRpc\Exception\ExceptionInterface $e) { throw new RepositoryInfrastructureException("Infrastructure exception.", 0, $e); } return $result; }