[otrs-cvs] otrs/scripts/test XML.t,1.10,1.11

cvs-log at otrs.org cvs-log at otrs.org
Mon Apr 2 07:38:28 GMT 2007


Comments:
Update of /home/cvs/otrs/scripts/test
In directory lancelot:/tmp/cvs-serv29309/scripts/test

Modified Files:
	XML.t 
Log Message:
Added checks for new cache mechanism.

Author: martin

Index: XML.t
===================================================================
RCS file: /home/cvs/otrs/scripts/test/XML.t,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** XML.t	31 Jan 2007 08:34:07 -0000	1.10
--- XML.t	2 Apr 2007 07:38:23 -0000	1.11
***************
*** 10,13 ****
--- 10,14 ----
  # --
  
+ use utf8;
  use Kernel::System::XML;
  use Kernel::System::Ticket;
***************
*** 16,20 ****
  $Self->{TicketObject} = Kernel::System::Ticket->new(%{$Self});
  
! my $String = '
      <Contact role="admin" type="organization">
        <Name type="long">Example Inc.</Name>
--- 17,21 ----
  $Self->{TicketObject} = Kernel::System::Ticket->new(%{$Self});
  
! my $String = '<?xml version="1.0" encoding="utf-8" ?>
      <Contact role="admin" type="organization">
        <Name type="long">Example Inc.</Name>
***************
*** 24,30 ****
        <Telephone2></Telephone2>
        <SpecialCharacters>\'</SpecialCharacters>
      </Contact>
  ';
- #       <Germantext>Alle Deutschen Umlaute öäü ÄÜÖ ß</Germantext>
  
  my @XMLHash = $Self->{XMLObject}->XMLParse2XMLHash(String => $String);
--- 25,31 ----
        <Telephone2></Telephone2>
        <SpecialCharacters>\'</SpecialCharacters>
+       <GermanText>German Umlaute öäü ÄÜÖ ß</GermanText>
      </Contact>
  ';
  
  my @XMLHash = $Self->{XMLObject}->XMLParse2XMLHash(String => $String);
***************
*** 78,86 ****
      'XMLHashGet() (Telephone2)',
  );
  
  my @XMLHashUpdate = ();
  $XMLHashUpdate[1]->{Contact}->[1]->{role} = 'admin1';
  $XMLHashUpdate[1]->{Contact}->[1]->{Name}->[1]->{Content} = 'Example Inc. 2';
! my $XMLHashUpdateTrue = $Self->{XMLObject}->XMLHashUpdate(
      Type => 'SomeType',
      Key => '123',
--- 79,148 ----
      'XMLHashGet() (Telephone2)',
  );
+ $Self->Is(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{GermanText}->[1]->{Content},
+     'German Umlaute öäü ÄÜÖ ß',
+     'XMLHashGet() (GermanText)',
+ );
+ 
+ @XMLHash = $Self->{XMLObject}->XMLHashGet(
+     Type => 'SomeType',
+     Key => '123',
+     Cache => 0,
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{role} eq 'admin',
+     'XMLHashGet() (admin) - without cache',
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{Telephone}->[1]->{country} eq 'germany',
+     'XMLHashGet() (Telephone->country) - without cache',
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{Telephone2}->[1]->{Content} eq '',
+     'XMLHashGet() (Telephone2) - without cache',
+ );
+ $Self->Is(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{GermanText}->[1]->{Content},
+     'German Umlaute öäü ÄÜÖ ß',
+     'XMLHashGet() (GermanText) - without cache',
+ );
+ 
+ my $XMLHashUpdateTrue = $Self->{XMLObject}->XMLHashUpdate(
+     Type => 'SomeType',
+     Key => '123',
+     XMLHash => \@XMLHash,
+ );
+ $Self->True(
+     $XMLHashUpdateTrue,
+     'XMLHashUpdate() (admin)',
+ );
+ 
+ @XMLHash = $Self->{XMLObject}->XMLHashGet(
+     Type => 'SomeType',
+     Key => '123',
+     Cache => 0,
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{role} eq 'admin',
+     'XMLHashGet() (admin) - without cache',
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{Telephone}->[1]->{country} eq 'germany',
+     'XMLHashGet() (Telephone->country) - without cache',
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{Telephone2}->[1]->{Content} eq '',
+     'XMLHashGet() (Telephone2) - without cache',
+ );
+ $Self->Is(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{GermanText}->[1]->{Content},
+     'German Umlaute öäü ÄÜÖ ß',
+     'XMLHashGet() (GermanText) - without cache',
+ );
  
  my @XMLHashUpdate = ();
  $XMLHashUpdate[1]->{Contact}->[1]->{role} = 'admin1';
  $XMLHashUpdate[1]->{Contact}->[1]->{Name}->[1]->{Content} = 'Example Inc. 2';
! $XMLHashUpdateTrue = $Self->{XMLObject}->XMLHashUpdate(
      Type => 'SomeType',
      Key => '123',
***************
*** 123,126 ****
--- 185,198 ----
  );
  
+ @XMLHash = $Self->{XMLObject}->XMLHashGet(
+     Type => 'SomeType',
+     Key => '123',
+     Cache => 0,
+ );
+ $Self->True(
+     $#XMLHash == 1 && $XMLHash[1]->{Contact}->[1]->{role} eq 'admin',
+     'XMLHashGet() (admin) - without cache',
+ );
+ 
  my $XML = $Self->{XMLObject}->XMLHash2XML(@XMLHash);
  @XMLHash = $Self->{XMLObject}->XMLParse2XMLHash(String => $XML);


More information about the cvs-log mailing list