Exemple #1
0
 /**
  * Generate a signature for the passed params
  *
  * @param array $params
  *
  * @return string
  */
 protected function generateSignature($params)
 {
     return $this->auth->getSignature($params);
 }
 public function testGetSignatureReturnsHashOfOrderedNonExcludedParams()
 {
     $params = array('a' => array(1, 2, 3), 'b' => 'a', 'c' => 'a', 'z' => 'a', 'object' => 'a', 'action' => 'a', 'response' => 'a', 'version' => 'a', 'signature' => 'a', 'site_key' => 'a', 'tm-token' => 'a', 'media' => 'a', 'media_file' => 'a', 'pretty' => 'a', 'anything else' => 'a');
     $result = $this->object->getSignature($params, 'secret');
     $this->assertSame(md5('secreta%5B0%5D=1&a%5B1%5D=2&a%5B2%5D=3&anything+else=a&b=a&c=a&z=a'), $result);
 }