/**
  * Creates a temporary account
  *
  * @param string $accountIdentifier
  * @param string $password
  * @param string $firstName
  * @param string $lastName
  * @return Account
  */
 protected function createTemporaryAccount($accountIdentifier, $password, $firstName, $lastName)
 {
     if (strlen($firstName) === 0 && strlen($lastName) === 0) {
         $firstName = 'Santa';
         $lastName = 'Claus';
     }
     $user = new User();
     $user->setName(new PersonName('', $firstName, '', $lastName));
     $user->getPreferences()->set('context.workspace', 'user-' . $accountIdentifier);
     $this->partyRepository->add($user);
     $account = $this->accountFactory->createAccountWithPassword($accountIdentifier, $password, array('TYPO3.Neos:Editor'), 'Typo3BackendProvider');
     $account->setParty($user);
     $account->setExpirationDate(new \DateTime('+1 week'));
     $this->accountRepository->add($account);
 }
 /**
  * @test
  */
 public function constructorInitializesPreferences()
 {
     $user = new User();
     $this->assertInstanceOf('TYPO3\\Neos\\Domain\\Model\\UserPreferences', $user->getPreferences());
 }
 /**
  * @test
  */
 public function constructorInitializesPreferences()
 {
     $user = new User();
     $this->assertInstanceOf(UserPreferences::class, $user->getPreferences());
 }