Пример #1
0
 public function testSettersAndGetters()
 {
     $firstName = 'John';
     $lastName = 'Doe';
     $socialSecurityNumber = '38601012796';
     $country = 'EST';
     $user = new User();
     $user->setCountry($country);
     $user->setFirstName($firstName);
     $user->setLastName($lastName);
     $user->setSocialSecurityNumber($socialSecurityNumber);
     $this->assertEquals($firstName, $user->getFirstName());
     $this->assertEquals($lastName, $user->getLastName());
     $this->assertEquals($socialSecurityNumber, $user->getSocialSecurityNumber());
     $this->assertEquals($country, $user->getCountry());
 }
Пример #2
0
 public static function login()
 {
     if (!self::isSuccessful()) {
         throw new AuthenticationException('User not authenticated!');
     }
     $cardInfo = explode('/', $_SERVER[self::SSL_CLIENT]);
     if (count($cardInfo) <= 1) {
         $cardInfo = explode(',', $_SERVER[self::SSL_CLIENT]);
     }
     $parameters = array();
     foreach ($cardInfo as $info) {
         if ($info != null) {
             $parameterArray = explode('=', $info);
             $parameters[$parameterArray[0]] = self::decodeToUtf8($parameterArray[1]);
         }
     }
     $user = new User();
     $user->setFirstName($parameters['GN']);
     $user->setLastName($parameters['SN']);
     $user->setSocialSecuritynumber($parameters['serialNumber']);
     $user->setCountry($parameters['C']);
     self::saveIdCardUserToSession($user);
 }