Exemplo n.º 1
0
 public function testCreateUserLogin()
 {
     $user = $this->dummyData->getUser();
     $this->userRepository->create($user);
     $userLogin = $this->dummyData->getUserLogin($user);
     $this->userRepository->update($user);
     $this->assertSame(1, $user->getTotalLogins());
 }
Exemplo n.º 2
0
 /**
  * @param Iterator $iterator
  * @return ImportResult
  */
 public function import(Iterator $iterator)
 {
     $importResult = new ImportResult();
     foreach ($iterator as $key => $row) {
         if ($key < 2 && $row[0] === 'id') {
             continue;
         }
         $externalId = $this->extractNull($row[0]);
         $name = $this->extractNull($row[1]);
         $address = $this->extractNull($row[2]);
         $zip5 = $this->extractNull($row[3]);
         $city = $this->extractNull($row[4]);
         $phone = $this->extractNull($row[5]);
         $fax = $this->extractNull($row[6]);
         $url = $this->extractNull($row[7]);
         $email = $this->extractNull($row[8]);
         $firstName = $this->parseFirstName($name);
         $lastName = $this->parseLastName($name);
         $user = new User();
         $user->setExternalId($externalId);
         $user->setFirstName($firstName);
         $user->setLastName($lastName);
         if (!empty($email)) {
             $user->setEmail($email);
         }
         try {
             $this->throwValidationErrors($user);
             $this->userRepository->create($user);
             $importResult->incrementSuccess();
         } catch (KommerceException $e) {
             $importResult->addFailedRow($row);
             $importResult->addErrorMessage($e->getMessage());
         }
     }
     return $importResult;
 }
Exemplo n.º 3
0
 public function create(User &$user)
 {
     $this->throwValidationErrors($user);
     $this->userRepository->create($user);
 }