Ejemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function createConsumer($consumerData)
 {
     try {
         $consumerData['key'] = $this->_oauthHelper->generateConsumerKey();
         $consumerData['secret'] = $this->_oauthHelper->generateConsumerSecret();
         $consumer = $this->_consumerFactory->create($consumerData);
         $consumer->save();
         return $consumer;
     } catch (\Magento\Framework\Exception\LocalizedException $exception) {
         throw $exception;
     } catch (\Exception $exception) {
         throw new \Magento\Framework\Oauth\Exception(__('Unexpected error. Unable to create oAuth consumer account.'));
     }
 }
Ejemplo n.º 2
0
 public function testGenerateConsumerKey()
 {
     $token = $this->_oauthHelper->generateConsumerKey();
     $this->assertTrue(is_string($token) && strlen($token) === Oauth::LENGTH_CONSUMER_KEY);
 }