public function testValidEmail() { $this->user->setEmail('*****@*****.**'); $this->assertEquals('*****@*****.**', $this->user->getEmail()); }
protected function evaluateGoodUserItem($data, User $user) { foreach (['@entity@' => V1Controller::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, 'login' => $user->getLogin() ?: null, 'first_name' => $user->getFirstName() ?: null, 'last_name' => $user->getLastName() ?: null, 'display_name' => $user->getDisplayName() ?: null, 'address' => $user->getAddress() ?: null, 'zip_code' => $user->getZipCode() ?: null, 'city' => $user->getCity() ?: null, 'country' => $user->getCountry() ?: null, 'phone' => $user->getPhone() ?: null, 'fax' => $user->getFax() ?: null, 'job' => $user->getJob() ?: null, 'position' => $user->getActivity() ?: null, 'company' => $user->getCompany() ?: null, 'geoname_id' => $user->getGeonameId() ?: null, 'last_connection' => $user->getLastConnection() ? $user->getLastConnection()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null] as $key => $value) { $this->assertArrayHasKey($key, $data, 'Assert key is present ' . $key); if ($value) { $this->assertEquals($value, $data[$key], 'Check key ' . $key); } } }
/** * * @param User $to * @param User $registeredUser * * @return boolean */ public function mail(User $to, User $registeredUser) { $body = ''; $body .= sprintf("Login : %s\n", $registeredUser->getLogin()); $body .= sprintf("%s : %s\n", _('admin::compte-utilisateur nom'), $registeredUser->getFirstName()); $body .= sprintf("%s : %s\n", _('admin::compte-utilisateur prenom'), $registeredUser->getLastName()); $body .= sprintf("%s : %s\n", _('admin::compte-utilisateur email'), $registeredUser->getEmail()); $body .= sprintf("%s/%s\n", $registeredUser->get_job(), $registeredUser->getCompany()); $readyToSend = false; try { $receiver = Receiver::fromUser($to); $readyToSend = true; } catch (\Exception $e) { } if ($readyToSend) { $mail = MailInfoSomebodyAutoregistered::create($this->app, $receiver, null, $body); $this->app['notification.deliverer']->deliver($mail); } return true; }
/** * Creates an Emitter given a User * * @param User $user * * @return Emitter * * @throws InvalidArgumentException In case no valid email is found for user */ public static function fromUser(User $user) { return new static($user->getDisplayName(), $user->getEmail()); }
/** * * @return ValidationData */ public function getUserValidationDatas(User $user) { foreach ($this->validation_datas as $validationData) { if ($validationData->getParticipant()->getUser()->getId() == $user->getId()) { return $validationData; } } throw new \Exception('There is no such participant ' . $user->getEmail()); }
private function formatUser(User $user) { $subtitle = array_filter([$user->getJob(), $user->getCompany()]); return ['type' => 'USER', 'usr_id' => $user->getId(), 'firstname' => $user->getFirstName(), 'lastname' => $user->getLastName(), 'email' => $user->getEmail(), 'display_name' => $user->getDisplayName(), 'subtitle' => implode(', ', $subtitle)]; }
private function list_user(User $user) { switch ($user->getGender()) { case User::GENDER_MR: $gender = 'Mr'; break; case User::GENDER_MRS: $gender = 'Mrs'; break; case User::GENDER_MISS: $gender = 'Miss'; break; } return ['@entity@' => self::OBJECT_TYPE_USER, 'id' => $user->getId(), 'email' => $user->getEmail() ?: null, 'login' => $user->getLogin() ?: null, 'first_name' => $user->getFirstName() ?: null, 'last_name' => $user->getLastName() ?: null, 'display_name' => $user->getDisplayName() ?: null, 'gender' => $gender, 'address' => $user->getAddress() ?: null, 'zip_code' => $user->getZipCode() ?: null, 'city' => $user->getCity() ?: null, 'country' => $user->getCountry() ?: null, 'phone' => $user->getPhone() ?: null, 'fax' => $user->getFax() ?: null, 'job' => $user->getJob() ?: null, 'position' => $user->getActivity() ?: null, 'company' => $user->getCompany() ?: null, 'geoname_id' => $user->getGeonameId() ?: null, 'last_connection' => $user->getLastConnection() ? $user->getLastConnection()->format(DATE_ATOM) : null, 'created_on' => $user->getCreated() ? $user->getCreated()->format(DATE_ATOM) : null, 'updated_on' => $user->getUpdated() ? $user->getUpdated()->format(DATE_ATOM) : null, 'locale' => $user->getLocale() ?: null]; }
/** * {@inheritDoc} */ public function getEmail() { $this->__initializer__ && $this->__initializer__->__invoke($this, 'getEmail', array()); return parent::getEmail(); }
/** * Get a participant * * @return ValidationParticipant */ public function getParticipant(User $user) { foreach ($this->getParticipants() as $participant) { if ($participant->getUser()->getId() == $user->getId()) { return $participant; } } throw new NotFoundHttpException('Participant not found' . $user->getEmail()); }