public function testDeleteToken()
 {
     $serviceMock = $this->getMock(ApiKeyFactoryInterface::class);
     $serviceMock->expects($this->any())->method('generateKeyCode')->will($this->returnValue(new ApiKey('api key')));
     $this->user->authenticateToken(new AuthDTO('Ma27', 'test-password'), $serviceMock);
     $this->assertInstanceOf(ApiKey::class, $this->user->getToken());
     $this->user->deleteToken();
     $this->assertNull($this->user->getToken());
 }
 /**
  * Removes the user token
  *
  * @param User $user
  */
 public function purgeToken(User $user)
 {
     $user->deleteToken();
     $this->userRepository->modify($user);
 }