Exemplo n.º 1
0
 public function testCreateCustomerToken()
 {
     $userId = 1;
     $token = 'token';
     $secret = 'secret';
     $this->oauthHelperMock->expects($this->once())->method('generateToken')->willReturn($token);
     $this->oauthHelperMock->expects($this->once())->method('generateTokenSecret')->willReturn($secret);
     $this->resourceMock->expects($this->once())->method('save');
     $result = $this->tokenModel->createCustomerToken($userId);
     $this->assertEquals($this->tokenModel, $result);
     $this->assertEquals($token, $result->getToken());
     $this->assertEquals($secret, $result->getSecret());
     $this->assertEquals($userId, $result->getCustomerId());
     $this->assertNotEquals($userId, $result->getAdminId());
     $this->assertEquals(UserContextInterface::USER_TYPE_CUSTOMER, $result->getUserType());
 }