Ejemplo n.º 1
0
 public function testFindByConsumerIdNotFound()
 {
     $this->_emptyIntegrationMock->expects($this->any())->method('getData')->will($this->returnValue(null));
     $this->_integrationMock->expects($this->once())->method('load')->with(self::VALUE_INTEGRATION_CONSUMER_ID, 'consumer_id')->will($this->returnValue($this->_emptyIntegrationMock));
     $integration = $this->_service->findByConsumerId(1);
     $this->assertNull($integration->getData());
 }
Ejemplo n.º 2
0
 /**
  * @param Token $token
  * @return void
  */
 protected function setUserDataViaToken(Token $token)
 {
     $this->userType = $token->getUserType();
     switch ($this->userType) {
         case UserContextInterface::USER_TYPE_INTEGRATION:
             $this->userId = $this->integrationService->findByConsumerId($token->getConsumerId())->getId();
             $this->userType = UserContextInterface::USER_TYPE_INTEGRATION;
             break;
         case UserContextInterface::USER_TYPE_ADMIN:
             $this->userId = $token->getAdminId();
             $this->userType = UserContextInterface::USER_TYPE_ADMIN;
             break;
         case UserContextInterface::USER_TYPE_CUSTOMER:
             $this->userId = $token->getCustomerId();
             $this->userType = UserContextInterface::USER_TYPE_CUSTOMER;
             break;
         default:
             /* this is an unknown user type so reset the cached user type */
             $this->userType = null;
     }
 }