Ejemplo n.º 1
0
 /**
  * @expectedException \Magento\Framework\Oauth\Exception
  * @expectedExceptionMessage A token with consumer ID 1 does not exist
  */
 public function testGetIntegrationTokenByConsumerIdException()
 {
     $consumerId = 1;
     $tokenId = false;
     $this->requestTokenMock->expects($this->once())->method('loadByConsumerIdAndUserType')->with($consumerId, UserContextInterface::USER_TYPE_INTEGRATION);
     $this->tokenFactoryMock->expects($this->once())->method('create')->willReturn($this->requestTokenMock);
     $this->requestTokenMock->expects($this->once())->method('getId')->willReturn($tokenId);
     $this->tokenProvider->getIntegrationTokenByConsumerId($consumerId);
 }
Ejemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function deleteIntegrationToken($consumerId)
 {
     try {
         $consumer = $this->_consumerFactory->create()->load($consumerId);
         $existingToken = $this->_tokenProvider->getIntegrationTokenByConsumerId($consumer->getId());
         $existingToken->delete();
         return true;
     } catch (\Exception $e) {
         return false;
     }
 }