Beispiel #1
0
		public function OnDomainCreated (Domain $Domain)
		{
			if ($this->once_run)
			{
				return;
			}
			
			$this->once_run = true;
	
	       	////
			// 3. CREATE 2 child name servers of newly created domain
			//
			try
			{
				$ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
				$ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
				
				$this->Registry->CreateNameserverHost($ns1);
				$this->Registry->CreateNameserverHost($ns2);
				
				$this->TestCase->assertTrue(true, 'Create nameservers');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Create nameservers. Error: ' . $e->getMessage());
			}
				
				
			////
			// 4. UPDATE Domain to attach child name servers to domain
			//
				
			try
			{
				$nslist = $Domain->GetNameserverChangelist();
				$nslist->Add($ns1);
				$nslist->Add($ns2);
				
				$this->Registry->UpdateDomainNameservers($Domain, $nslist);
				
				$this->TestCase->assertTrue(
					count($Domain->GetNameserverList()) == 4,
					'Attach nameservers to domain'
				);
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Attach nameservers to domain. Error: ' . $e->getMessage());
			}
				
			////
			// Create tech contact
			// 
			try
			{
				$Tech = $this->Registry->NewContactInstance(CONTACT_TYPE::TECH);
				$Tech->SetFieldList($this->contact_fields);
				
				$this->Registry->CreateContact($Tech);
				
				$this->TestCase->assertTrue(true, 'Create another contact');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Create another contact. Error: ' . $e->getMessage());
			}
				
			////
			// Update domain contact
			try
			{
				$this->Registry->UpdateDomainContact($Domain, CONTACT_TYPE::TECH, null, $Tech);
				
				$this->TestCase->assertTrue(true, 'Attach contact to domain');
			}	
			catch (Exception $e)
			{
				return $this->TestCase->fail('Attach contact to domain. Error: ' . $e->getMessage());
			}
			
	
			////
			// 6. Perform an INFO command on the domain to verify update
			//
				
			try
			{
				$RDomain = $this->Registry->NewDomainInstance();
				$RDomain->Name = $Domain->Name;
				
				$RDomain = $this->Registry->GetRemoteDomain($RDomain);
				
				
				$this->TestCase->assertTrue(
					$RDomain->Name == $Domain->Name &&
					date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) &&
					date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) &&
					count($RDomain->GetNameserverList()) == count($Domain->GetNameserverList()) &&
					$RDomain->GetContact(CONTACT_TYPE::TECH)->CLID == $Tech->CLID,
					'Get remote domain'
				);
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Get remote domain. Error: ' . $e->getMessage());
			}
				
				
			////
			// 10. UPDATE one of the name server’s IP Address
			//
			
			try
			{
				$ns1->IPAddr = gethostbyname('ns.hostdad.com');
				$Resp = $this->Registry->GetModule()->UpdateNameserverHost($ns1);
				
				$this->TestCase->assertTrue($Resp->Result, 'Update domain nameserver');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Update domain nameserver. Error: ' . $e->getMessage());
			}
				
				
			////
			// 12. Renew Domain for 2 years
			//
				
			/*
			try
			{
				$this->Registry->RenewDomain($Domain, $extra=array('period' => 2));
				
				$this->TestCase->assertFalse(true, 'Domain renewal. Exception expected');
			}
			catch (Exception $e)
			{
				$this->TestCase->assertTrue($e->getMessage() == 'A domain can not be renewed earlier that 365 days from its expiration', 'Domain renewal');
			}
			*/
				
			
			// secondary registry
			$DataForm = new DataForm();
			$DataForm->AppendField( new DataFormField("ServerHost", FORM_FIELD_TYPE::TEXT, null, null, null, null, 'https://devepp.ics.forth.gr:700/epp/proxy'));
			$DataForm->AppendField( new DataFormField("Login", FORM_FIELD_TYPE::TEXT, null, null, null, null, 'digitalbox1'));
			$DataForm->AppendField( new DataFormField("Password", FORM_FIELD_TYPE::TEXT , null, null, null, null, 'agrigo'));
			$DataForm->AppendField( new DataFormField("ClientPrefix", FORM_FIELD_TYPE::TEXT, null, null, null, null, '371'));	
			$DataForm->AppendField( new DataFormField("UseSSLCert", FORM_FIELD_TYPE::CHECKBOX, null, null, null, null, '1'));	
			$DataForm->AppendField( new DataFormField("SSLpwd", FORM_FIELD_TYPE::TEXT, null, null, null, null, 'devepp'));	
			$DataForm->AppendField( new DataFormField("CLID", FORM_FIELD_TYPE::TEXT, null, null, null, null, 'digitalbox1'));
			$DataForm->AppendField( new DataFormField("SSLCertPath", FORM_FIELD_TYPE::TEXT, null, null, null, null, '/home/marat/webdev/epp-drs/branches/dev/app/modules/registries/EPPGR/ssl/cert.pem'));		
			
			
			$Module = new EPPGRRegistryModule();
			$Module->InitializeModule('gr', $DataForm);
			$Registry2 = new Registry($Module);		
			try
			{
				$ok = $Registry2->TransferRequest($Domain, array('pw' => $Domain->AuthCode));
				
				$this->TestCase->assertTrue($ok, 'Request domain transfer from another session');
			}
			catch (Exception $e)
			{
				$this->TestCase->fail('Request domain transfer from another session. Error: ' . $e->getMessage());
			}
			
			////
			// 17. Approve the Transfer using your OT&E1 account
			//
			
			try
			{
				$ok = $this->Registry->TransferApprove($Domain);
				
				$this->TestCase->assertTrue($ok, 'Approve transfer');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Approve transfer. Error: ' . $e->getMessage());
			}
			
			
			////
			// 19. Initiate the Transfer again using your OT&E1 account 
			//
			
			try
			{
				$ok = $this->Registry->TransferRequest($Domain, array('pw' => $Domain->AuthCode));
				
				$this->TestCase->assertTrue($ok, 'Initiate transfer account 1');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Initiate tranfer account 1. Error: ' . $e->getMessage());
			}
			
			
			////
			// 21. Reject the Transfer using your OT&E2 account
			//
			
			try
			{
				$ok = $Registry2->TransferReject($Domain);
				
				$this->TestCase->assertTrue($ok, 'Reject transfer account 2');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Reject transfer account 2. Error: ' . $e->getMessage());
			}
			
			
				
			////
			// Remove domain nameservers
			
			try
			{
				$ns_list = $Domain->GetNameserverList();
				$Changes = $Domain->GetNameserverChangelist();
				foreach ($ns_list as $NS)
				{
					$Changes->Remove($NS);
				}
				
				$Registry2->UpdateDomainNameservers($Domain, $Changes);
	
				$this->TestCase->assertTrue(count($Domain->GetNameserverList()) == 0, 'Remove nameservers from domain');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Remove nameservers from domain. Error: ' . $e->getMessage());
			}
				
			////
			// Delete nameservers
			
			try
			{
				$Registry2->DeleteNameserverHost($ns1);
				$Registry2->DeleteNameserverHost($ns2);
				
				$this->TestCase->assertTrue(true, 'Delete nameservers');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Delete nameservers. Error: ' . $e->getMessage());
			}
				
				
			////
			// Delete domain
			
			try
			{
				$Registry2->DeleteDomain($Domain);
				$this->TestCase->assertTrue(true, 'Delete domain');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Delete domain. Error: ' . $e->getMessage());
			}
	
			
			////
			/// Delete contact
			
			try
			{
				$Registry2->DeleteContact($Tech);
				$Registry2->DeleteContact($Domain->GetContact(CONTACT_TYPE::REGISTRANT));
				$this->TestCase->assertTrue(true, 'Delete contact');
			}
			catch (Exception $e)
			{
				return $this->TestCase->fail('Delete contact. Error: ' . $e->getMessage());
			}
		}
Beispiel #2
0
        function _testEPP ()
        {
			$Domain = $this->Registry->NewDomainInstance();
			$Domain->Name = 'webta' . rand(1000, 9999);
        	
			var_dump($Domain->Name);
			
			////
			// Check domain
        	$ok = $this->Registry->DomainCanBeRegistered($Domain);
			$this->assertTrue($ok, 'Domain available for registration');
        	
			////
			// Create contact
			$Registrant = $this->Registry->NewContactInstanceByGroup('generic');
			$Registrant->SetFieldList($this->contact_data);
			$this->Registry->CreateContact($Registrant);
			$this->assertTrue(true, 'Create contact');

			////
			// Get remote contact
			$RRegistrant = $this->Registry->NewContactInstanceByGroup('generic');
			$RRegistrant->CLID = $Registrant->CLID;
			
			$this->Registry->GetRemoteContact($RRegistrant);
			
			$fields = $Registrant->GetFieldList();
			$rfields = $RRegistrant->GetFieldList();
			
			$this->assertTrue(
				$fields['name'] == $rfields['name'] &&
				$fields['email'] == $rfields['email'] &&
				$fields['voice'] == $rfields['voice'],
				'Get remote contact'
			);
			
			////
			// Create domain
			$Domain->SetContact($Registrant, CONTACT_TYPE::REGISTRANT);
			$Domain->SetContact($Registrant, CONTACT_TYPE::ADMIN);
			$Domain->SetContact($Registrant, CONTACT_TYPE::TECH);
			$Domain->SetContact($Registrant, CONTACT_TYPE::BILLING);
			$Domain->SetNameserverList(array(
				new Nameserver('ns.hostdad.com'),
				new Nameserver('ns2.hostdad.com')
			));
			
			$this->Registry->CreateDomain($Domain, 2);
			$this->assertTrue(true, 'Create domain');
			
			////
			// Create nameservers 
			$ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
			$ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
			
			$this->Registry->CreateNameserverHost($ns1);
			$this->Registry->CreateNameserverHost($ns2);
			
			$this->assertTrue(true, 'Create nameservers');
			
			////
			// Attach nameservers to domain
			$nslist = $Domain->GetNameserverChangelist();
			$nslist->Add($ns1);
			$nslist->Add($ns2);
			
			$this->Registry->UpdateDomainNameservers($Domain, $nslist);
			
			$this->assertTrue(
				count($Domain->GetNameserverList()) == 4,
				'Attach nameservers to domain'
			);
			
			////
			// Create contact and update domain tech contact
			$Tech = $this->Registry->NewContactInstance(CONTACT_TYPE::TECH);
			$Tech->SetFieldList(array_merge($this->contact_data, array(
				'firstname' => 'Nikolas',
				'lastname' => 'Toursky'
			)));
			$this->Registry->CreateContact($Tech);
			
			$this->Registry->UpdateDomainContact($Domain, CONTACT_TYPE::TECH, $Registrant, $Tech);
			$this->assertTrue(true, 'Attach contact to domain');
			
			////
			// Lock domain
			$ok = $this->Registry->LockDomain($Domain);
			$this->assertTrue($ok, 'Lock domain');
			
			////
			// Perform info to verify update
			$RDomain = $this->Registry->NewDomainInstance();
			$RDomain->Name = $Domain->Name;
			
			$RDomain = $this->Registry->GetRemoteDomain($RDomain);
			
			$this->assertTrue(
				$RDomain->Name == $Domain->Name &&
				date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) &&
				date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) &&
				count($RDomain->GetNameserverList()) == count($Domain->GetNameserverList()) &&
				$RDomain->GetContact(CONTACT_TYPE::TECH)->CLID == $Tech->CLID,
				'Get remote domain'
			);
			
			////
			// Unlock domain
			$ok = $this->Registry->UnlockDomain($Domain);
			$this->assertTrue($ok, 'Unlock domain');
			
			////
			// UPDATE one of the name server�s IP Address
			$ns1->IPAddr = gethostbyname('ns.hostdad.com');
			$Resp = $this->Registry->GetModule()->UpdateNameserverHost($ns1);
			$this->assertTrue($Resp->Result, 'Update domain nameserver');
			
			/*
			////
			// Renew domain for 2 years 
			$old_expire_date = $Domain->ExpireDate;
			$this->Registry->RenewDomain($Domain, $extra=array('period' => 2));
			$this->assertTrue(
				date('Ymd', $Domain->ExpireDate) == date('Ymd', strtotime('+2 year', $old_expire_date)),
				'Domain renewal'
			);
			*/
			
			////
			// Remove nameservers from domain 
			$ns_list = $Domain->GetNameserverList();
			$Changes = $Domain->GetNameserverChangelist();
			foreach ($ns_list as $NS)
			{
				$Changes->Remove($NS);
			}
			$this->Registry->UpdateDomainNameservers($Domain, $Changes);
			$this->assertTrue(count($Domain->GetNameserverList()) == 0, 'Remove nameservers from domain');
			
			////
			// Delete nameservers
			foreach ($ns_list as $NS)
			{
				if (preg_match('/'.$Domain->Name.'/', $NS->HostName))
				{
					$this->Registry->DeleteNameserverHost($NS);
				}
			}
			$this->assertTrue(true, 'Delete nameservers');
			
			////
			// Delete domain
			$this->Registry->DeleteDomain($Domain);
			$this->assertTrue(true, 'Delete domain');
			
			////
			// Delete contacts
			$this->Registry->DeleteContact($Registrant);
			$this->Registry->DeleteContact($Tech);
			$this->assertTrue(true, 'Delete contacts');
        }
Beispiel #3
0
 function testEPP()
 {
     $Domain = $this->Registry->NewDomainInstance();
     $Domain->Name = 'webta' . rand(1000, 9999);
     // check domain
     try {
         $ok = $this->Registry->DomainCanBeRegistered($Domain)->Result;
         $this->assertTrue($ok, 'Domain available for registration');
     } catch (Exception $e) {
         return $this->fail('Domain available for registration. Error: ' . $e->getMessage());
     }
     ////
     // Create contact
     try {
         $Registrant = $this->Registry->NewContactInstanceByGroup('generic');
         $Registrant->SetFieldList($this->contact_fields);
         $this->Registry->CreateContact($Registrant);
         $this->assertTrue(true, 'Create contact');
     } catch (Exception $e) {
         return $this->fail('Create contact. Error: ' . $e->getMessage());
     }
     ////
     // Get contact INFO
     try {
         $RRegistrant = $this->Registry->NewContactInstanceByGroup('generic');
         $RRegistrant->CLID = $Registrant->CLID;
         $this->Registry->GetRemoteContact($RRegistrant);
         $fields = $Registrant->GetFieldList();
         $rfields = $RRegistrant->GetFieldList();
         ksort($fields);
         ksort($rfields);
         $discloses = $Registrant->GetDiscloseList();
         $rdiscloses = $RRegistrant->GetDiscloseList();
         ksort($discloses);
         ksort($rdiscloses);
         $this->assertTrue($fields['name'] == $rfields['name'] && $fields['email'] == $rfields['email'] && $fields['voice'] == $rfields['voice'] && $discloses == $rdiscloses, 'Get remote contact');
     } catch (Exception $e) {
         return $this->fail('Get remote contact. Error: ' . $e->getMessage());
     }
     try {
         $Domain->SetContact($Registrant, CONTACT_TYPE::REGISTRANT);
         $this->Registry->CreateDomain($Domain, 2);
         $this->assertTrue(true, 'Create domain');
     } catch (Exception $e) {
         return $this->fail('Create domain. Error: ' . $e->getMessage());
     }
     ////
     // 3. CREATE 2 child name servers of newly created domain
     //
     try {
         $ns1 = new NameserverHost('ns1.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $ns2 = new NameserverHost('ns2.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $ns3 = new NameserverHost('ns3.' . $Domain->GetHostName(), gethostbyname('hostdad.com'));
         $this->Registry->CreateNameserverHost($ns1);
         $this->Registry->CreateNameserverHost($ns2);
         $this->Registry->CreateNameserverHost($ns3);
         $this->assertTrue(true, 'Create nameservers');
     } catch (Exception $e) {
         return $this->fail('Create nameservers. Error: ' . $e->getMessage());
     }
     ////
     // 4. UPDATE Domain to attach child name servers to domain
     //
     try {
         $nslist = $Domain->GetNameserverChangelist();
         $nslist->Add($ns1);
         $nslist->Add($ns2);
         $nslist->Add($ns3);
         $this->Registry->UpdateDomainNameservers($Domain, $nslist);
         $this->assertTrue(count($Domain->GetNameserverList()) == 3, 'Attach nameservers to domain');
     } catch (Exception $e) {
         return $this->fail('Attach nameservers to domain. Error: ' . $e->getMessage());
     }
     ////
     // 5. UPDATE Domain�s status to
     // clientHold, clientUpdateProhibited, clientDeleteProhibited, and clientTransferProhibited
     // within one command
     try {
         $flag_list = $Domain->GetFlagChangelist();
         $flag_list->SetChangedList(array('clientUpdateProhibited', 'clientDeleteProhibited', 'clientTransferProhibited'));
         $this->Registry->UpdateDomainFlags($Domain, $flag_list);
         $this->assertTrue(count($Domain->GetFlagList()) == count($flag_list->GetList()), 'Update domain status');
     } catch (Exception $e) {
         return $this->fail('Update domain status. Error: ' . $e->getMessage());
     }
     ////
     // 6. Perform an INFO command on the domain to verify update
     //
     try {
         $RDomain = $this->Registry->NewDomainInstance();
         $RDomain->Name = $Domain->Name;
         $RDomain = $this->Registry->GetRemoteDomain($RDomain);
         $flags = $Domain->GetFlagList();
         $rflags = $RDomain->GetFlagList();
         sort($flags);
         sort($rflags);
         $this->assertTrue($RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $rflags == $flags, 'Get remote domain');
     } catch (Exception $e) {
         return $this->fail('Get remote domain. Error: ' . $e->getMessage());
     }
     ////
     // 7. UPDATE Domain�s status to OK
     //
     try {
         $changes = $Domain->GetFlagChangelist();
         foreach ($RDomain->GetFlagList() as $flag) {
             $changes->Remove($flag);
         }
         $this->Registry->UpdateDomainFlags($Domain, $changes);
         //$changes = $Domain->GetFlagChangelist();
         //$changes->Add('ok');
         //$this->Registry->UpdateDomainFlags($Domain, $changes);
         $this->assertTrue($Domain->GetFlagList() == array(), 'Update domain status');
         $Domain->SetFlagList(array('ok'));
         // ok flag set automatical when all other were removed
         // ^our bug ?
     } catch (Exception $e) {
         return $this->fail('Update domain status. Error: ' . $e->getMessage());
     }
     ////
     // 8. Perform an INFO command on the domain to verify update
     //
     try {
         $RDomain = $this->Registry->NewDomainInstance();
         $RDomain->Name = $Domain->Name;
         $RDomain = $this->Registry->GetRemoteDomain($RDomain);
         $this->assertTrue($RDomain->Name == $Domain->Name && date('Ymd', $RDomain->CreateDate) == date('Ymd', $Domain->CreateDate) && date('Ymd', $RDomain->ExpireDate) == date('Ymd', $Domain->ExpireDate) && $RDomain->GetFlagList() == array('ok'), 'Get remote domain');
     } catch (Exception $e) {
         return $this->fail('Get remote domain. Error: ' . $e->getMessage());
     }
     ////
     // 10. UPDATE one of the name server�s IP Address
     //
     try {
         $ns1->IPAddr = gethostbyname('ns.hostdad.com');
         $Resp = $this->Registry->GetModule()->UpdateNameserverHost($ns1);
         $this->assertTrue($Resp->Result, 'Update domain nameserver');
     } catch (Exception $e) {
         return $this->fail('Update domain nameserver. Error: ' . $e->getMessage());
     }
     ////
     // 12. Renew Domain for 2 years
     //
     try {
         $old_expire_date = $Domain->ExpireDate;
         $this->Registry->RenewDomain($Domain, $extra = array('period' => 2));
         $this->assertTrue(date('Ymd', $Domain->ExpireDate) == date('Ymd', strtotime('+2 year', $old_expire_date)), 'Domain renewal');
     } catch (Exception $e) {
         return $this->fail('Domain renewal. Error: ' . $e->getMessage());
     }
     ////
     // Remove domain nameservers
     try {
         $nslist = $Domain->GetNameserverChangelist();
         $nslist->Remove($ns1);
         $nslist->Remove($ns2);
         $nslist->Remove($ns3);
         $this->Registry->UpdateDomainNameservers($Domain, $nslist);
         $this->assertTrue(count($Domain->GetNameserverList()) == 0, 'Remove nameservers from domain');
     } catch (Exception $e) {
         return $this->fail('Remove nameservers from domain. Error: ' . $e->getMessage());
     }
     ////
     // Delete nameservers
     try {
         $this->Registry->DeleteNameserverHost($ns1);
         $this->Registry->DeleteNameserverHost($ns2);
         $this->assertTrue(true, 'Delete nameservers');
     } catch (Exception $e) {
         return $this->fail('Delete nameservers. Error: ' . $e->getMessage());
     }
     ////
     // Delete domain
     try {
         $this->Registry->DeleteDomain($Domain);
         $this->assertTrue(true, 'Delete domain');
     } catch (Exception $e) {
         return $this->fail('Delete domain. Error: ' . $e->getMessage());
     }
     ////
     /// Delete contact
     try {
         $this->Registry->DeleteContact($Registrant);
         $this->assertTrue(true, 'Delete contact');
     } catch (Exception $e) {
         return $this->fail('Delete contact. Error: ' . $e->getMessage());
     }
 }
 public function Run()
 {
     $DbDomain = DBDomain::GetInstance();
     $DbNameserverHost = DBNameserverHost::GetInstance();
     // Cleanup previous execution traces
     try {
         $this->Module->Request("domain-delete", array("name" => "testeppart.kz"));
     } catch (Exception $e) {
     }
     try {
         $Domain = $DbDomain->LoadByName('testeppart', 'kz');
         $this->Registry->DeleteDomain($Domain);
     } catch (Exception $e) {
     }
     try {
         $this->Module->Request("domain-delete", array("name" => "newtesteppart.kz"));
     } catch (Exception $e) {
     }
     try {
         $Domain = $DbDomain->LoadByName('newtesteppart', 'kz');
         $this->Registry->DeleteDomain($Domain);
     } catch (Exception $e) {
     }
     //
     // 1. Create domain
     //
     $Contact = $this->Registry->NewContactInstance(CONTACT_TYPE::REGISTRANT);
     $Contact->SetFieldList($this->contact_fields);
     $this->Registry->CreateContact($Contact);
     $Domain = $this->Registry->NewDomainInstance();
     $Domain->UserID = 39;
     $Domain->Name = 'testeppart';
     $Domain->Period = 1;
     $Domain->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
     $Domain->SetContact($Contact, CONTACT_TYPE::ADMIN);
     $Domain->SetContact($Contact, CONTACT_TYPE::TECH);
     $Domain->SetContact($Contact, CONTACT_TYPE::BILLING);
     $this->Registry->CreateDomain($Domain, $Domain->Period);
     $NS1 = new NameserverHost('ns1.testeppart.kz', '212.110.212.110');
     $this->Registry->CreateNameserver($NS1);
     $NS2 = new NameserverHost('ns2.testeppart.kz', '212.110.111.111');
     $this->Registry->CreateNameserver($NS2);
     $Changelist = $Domain->GetNameserverChangelist();
     $Changelist->Add($NS1);
     $Changelist->Add($NS2);
     $this->Registry->UpdateDomainNameservers($Domain, $Changelist);
     $this->AssertTrue(date('Ymd', $Domain->ExpireDate) == date('Ymd', strtotime('+1 year')) && count($Domain->GetNameserverList()) == 2, 'Create domain');
     // Reload domain from Db for correct operations
     $Domain = $DbDomain->LoadByName('testeppart', 'kz');
     $DbNameserverHost->LoadList($Domain->ID);
     //
     // 2. Update nameserver host
     //
     $nslist = $Domain->GetNameserverList();
     $NS2 = $nslist[1];
     $NS2->IPAddr = '212.111.110.110';
     $this->Registry->UpdateNameserverHost($NS2);
     $this->assertTrue(true, 'Update nameserver host');
     //
     // 3. Create nameserver host
     //
     $Domain4Host = $this->Registry->NewDomainInstance();
     $Domain4Host->UserID = 39;
     $Domain4Host->Name = 'newtesteppart';
     $Domain4Host->Period = 1;
     $Domain4Host->SetContact($Contact, CONTACT_TYPE::REGISTRANT);
     $this->Registry->CreateDomain($Domain4Host, $Domain4Host->Period);
     $NS3 = new NameserverHost('ns.newtesteppart.kz', '211.211.211.211');
     $this->Registry->CreateNameserverHost($NS3);
     $this->assertTrue(true, 'Create nameserver host');
     //
     // 4. Add nameserver to domain
     //
     $Changelist = $Domain->GetNameserverChangelist();
     $Changelist->Add($NS3);
     $this->Registry->UpdateDomainNameservers($Domain, $Changelist);
     $this->assertTrue(count($Domain->GetNameserverList()) == 3, 'Add nameserver to domain');
     //
     // 5. Remove nameserver from domain
     //
     $nslist = $Domain->GetNameserverList();
     $NS1 = $nslist[0];
     $Changelist = $Domain->GetNameserverChangelist();
     $Changelist->Remove($NS1);
     $this->Registry->UpdateDomainNameservers($Domain, $Changelist);
     $this->assertTrue(count($Domain->GetNameserverList()) == 2, 'Remove nameserver from domain');
     //
     // 6. Delete nameserver host
     //
     try {
         $this->Registry->DeleteNameserverHost($NS1);
         $this->assertTrue(true, 'Delete nameserver host');
     } catch (Exception $e) {
         $this->assertTrue(true, 'Delete nameserver host failed. Don\'t forget to cheat response code');
     }
     //
     // 7. Update contact
     //
     $contact_fields = $Contact->GetFieldList();
     $contact_fields['voice'] = '+380-555-7654321';
     $this->Registry->UpdateContact($Contact);
     $this->assertTrue(true, 'Update contact');
     //
     // 8. Start ingoing transfer
     //
     $TrnDomain = $this->Registry->NewDomainInstance();
     $TrnDomain->Name = 'xyz1';
     $TrnDomain->UserID = 39;
     $this->Registry->TransferRequest($TrnDomain, array('pw' => '123456'));
     $this->Registry->DeleteDomain($Domain);
     $this->Registry->DeleteContact($Contact);
 }