public function testClient() { $client = new BasicClient(); $client->setCode('1234'); $client->setSecret('secret'); $this->assertInstanceOf('Caparica\\Client\\ClientInterface', $client); $this->assertEquals('1234', $client->getCode()); $this->assertEquals('secret', $client->getSecret()); }
/** * because we say we do not validate the TS so not having a timestamp should be ok */ public function testValidSignature_NO_TIMESTAMP_DO_NOT_CHECK_TS_FLAG() { $object = $this->obj; // see fixtures/api-clients.yml for values $password = '******'; $clientId = '1234'; $client = new BasicClient(); $client->setCode($clientId); $client->setSecret($password); $params = array('a' => 'bcd', 'c' => '123', 'b' => 'ewq'); $urlToSign = 'a=bcd&b=ewq&c=123&X-CAPARICA-DATE=20130101092356'; $requestSignature = hash_hmac('sha256', $urlToSign, $password); $object->setValidateTimestamp(false); $isValid = $object->validate($client, $requestSignature, $params); }