public function testConvertToAccess() { $token = 'token'; $secret = 'secret'; $this->tokenModel->setType(Token::TYPE_REQUEST); $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->convertToAccess(); $this->assertEquals($this->tokenModel, $result); $this->assertEquals($token, $result->getToken()); $this->assertEquals($secret, $result->getSecret()); $this->assertEquals(UserContextInterface::USER_TYPE_INTEGRATION, $result->getUserType()); }