private function getSuccessfulIdentity()
 {
     $personalDetails = new PersonalDetails();
     $personalDetails->setForename('Snow')->setMiddleName('White')->setSurname('Huntsman')->setGender('Female')->setDateOfBirth(1976, 3, 6);
     $identity = new Identity();
     $identity->setPersonalDetails($personalDetails);
     return $identity;
 }
 public function testNZDrivingLicence()
 {
     $identity = new Identity();
     $container = new DocumentContainer();
     $licence = new DrivingLicence();
     $licence->setNumber('DI123456')->setVersion(123)->setVehicleRegistration('ABC123');
     $container->addIdentityDocument($licence, 'New Zealand');
     $identity->setIdentityDocuments($container);
     $r = new AuthenticateSPRequest();
     $r->addFieldsFromIdentity($identity);
     $test = $r->getInputData()->IdentityDocuments;
     $this->assertSame('DI123456', $test->NewZealand->DrivingLicence->Number);
     $this->assertSame(123, $test->NewZealand->DrivingLicence->Version);
     $this->assertSame('ABC123', $test->NewZealand->DrivingLicence->VehicleRegistration);
 }
 private function addIdentityDocuments(Identity $identity)
 {
     $this->InputData->IdentityDocuments = new \stdClass();
     $documents = $identity->getIdentityDocuments();
     if (is_a($documents, '\\ID3Global\\Identity\\Documents\\DocumentContainer')) {
         $passport = $documents->getInternationalPassport();
         if (is_a($passport, '\\ID3Global\\Identity\\Documents\\InternationalPassport')) {
             $this->InputData->IdentityDocuments->InternationalPassport = $passport;
         }
         foreach ($documents->getValidCountries() as $country) {
             $varName = sprintf('get%sDocuments', $country);
             $countryDocuments = $documents->{$varName}();
             if (is_object($countryDocuments)) {
                 $this->InputData->IdentityDocuments->{$country} = $countryDocuments;
             }
         }
     }
 }