Beispiel #1
0
 public function testSetParametersViaSetParameter()
 {
     $request = new Request();
     $request->setParameter('param1', 'foo');
     $request->setParameter('param2', 'bar');
     $this->assertEquals(2, count($request->getParameters()));
     $this->assertEquals('foo', $request->getParameter('param1'));
     $this->assertEquals('bar', $request->getParameter('param2'));
     $request->setParameter('param3', 'foo');
     $request->setParameter('param4', 'bar');
     $this->assertEquals(4, count($request->getParameters()));
     $this->assertEquals('foo', $request->getParameter('param3'));
     $this->assertEquals('bar', $request->getParameter('param4'));
 }
Beispiel #2
0
 /**
  * Create request object
  * @param  string $method
  * @param  array  $params
  * @return Request
  */
 public function createRequest($method, $params)
 {
     $request = new Request($params);
     $request->setParameter('method', $method);
     $request->setParameter('format', 'json');
     if (false === $request->hasParameter('api_key')) {
         $request->setParameter('api_key', $this->getRtm()->getApiKey());
     }
     if (false === $request->hasParameter('auth_token')) {
         $request->setParameter('auth_token', $this->getRtm()->getAuthToken());
     }
     $request->sign($this->getRtm()->getSecret());
     return $request;
 }