public function testCreateNewTokenUntilOneDoesNotExist()
 {
     $token = new AccessToken();
     $this->scopeService->expects($this->once())->method('getDefaultScopes')->will($this->returnValue(['read']));
     $this->tokenRepository->expects($this->at(0))->method('findByToken')->with($this->isType('string'))->will($this->returnValue(new AccessToken()));
     $this->tokenRepository->expects($this->at(1))->method('findByToken')->with($this->isType('string'))->will($this->returnValue(null));
     $this->tokenService->createToken($token);
     $this->assertEquals(40, strlen($token->getToken()));
 }
 /**
  * Remove the abstract token from the underlying storage
  *
  * @param  AbstractToken $token
  * @return void
  */
 public function deleteToken(AbstractToken $token)
 {
     $this->tokenRepository->deleteToken($token);
 }