[otrs-cvs] otrs/scripts/test Stats.t,1.4,1.5

cvs-log at otrs.org cvs-log at otrs.org
Fri Apr 13 06:11:55 GMT 2007


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

Modified Files:
	Stats.t 
Log Message:
included csv class and improved the import-export check

Author: tr

Index: Stats.t
===================================================================
RCS file: /home/cvs/otrs/scripts/test/Stats.t,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Stats.t	31 Oct 2006 14:50:48 -0000	1.4
--- Stats.t	13 Apr 2007 06:11:50 -0000	1.5
***************
*** 1,5 ****
  # --
  # scripts/test/Stats.t - stats module testscript
! # Copyright (C) 2001-2006 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
--- 1,5 ----
  # --
  # scripts/test/Stats.t - stats module testscript
! # Copyright (C) 2001-2007 OTRS GmbH, http://otrs.org/
  # --
  # $Id$
***************
*** 14,22 ****
  use Kernel::System::User;
  use Kernel::System::Main;
  $Self->{UserID} = 1;
! $Self->{GroupObject}    = Kernel::System::Group    ->new(%{$Self});
! $Self->{UserObject}     = Kernel::System::User     ->new(%{$Self});
! $Self->{MainObject}     = Kernel::System::Main     ->new(%{$Self});
! $Self->{StatsObject}    = Kernel::System::Stats    ->new(%{$Self});
  
  # check the StatsAddfunction
--- 14,25 ----
  use Kernel::System::User;
  use Kernel::System::Main;
+ use Kernel::System::CSV;
+ 
  $Self->{UserID} = 1;
! $Self->{GroupObject} = Kernel::System::Group->new(%{$Self});
! $Self->{UserObject} = Kernel::System::User->new(%{$Self});
! $Self->{MainObject} = Kernel::System::Main->new(%{$Self});
! $Self->{CSVObject} = Kernel::System::CSV->new(%{$Self});
! $Self->{StatsObject} = Kernel::System::Stats->new(%{$Self});
  
  # check the StatsAddfunction
***************
*** 24,27 ****
--- 27,31 ----
  my $StatID2 = $Self->{StatsObject}->StatsAdd();
  
+ # test 1
  $Self->True(
      $StatID1 > 0,
***************
*** 29,32 ****
--- 33,37 ----
  );
  
+ # test 2
  $Self->True(
      $StatID2 > 0,
***************
*** 34,37 ****
--- 39,43 ----
  );
  
+ # test 3
  $Self->True(
      $StatID2 > $StatID1,
***************
*** 39,43 ****
  );
  
! # check the stats update function
  $Self->True(
      $Self->{StatsObject}->StatsUpdate(
--- 45,49 ----
  );
  
! # test 4 - check the stats update function
  $Self->True(
      $Self->{StatsObject}->StatsUpdate(
***************
*** 50,53 ****
--- 56,60 ----
      "StatsUpdate() Update StatID1",
  );
+ 
  $Self->False(
      $Self->{StatsObject}->StatsUpdate(
***************
*** 136,140 ****
      'Export() check if Exportfile has a content',
  );
- 
  # import the exportet stat
  my $StatID3 = $Self->{StatsObject}->Import(
--- 143,146 ----
***************
*** 150,154 ****
      StatID => $StatID3,
  );
- 
  $Self->Is(
      $Stat3->{Title},
--- 156,159 ----
***************
*** 197,205 ****
          Content  => $ImportContent,
      );
      $ExportContent =  $Self->{StatsObject}->Export(StatID => $StatID);
      $Self->Is(
          $ImportContent,
          $ExportContent->{Content},
!         'Export-Importcheck - check if import file content equal export file content'
      );
  }
--- 202,216 ----
          Content  => $ImportContent,
      );
+ 
      $ExportContent =  $Self->{StatsObject}->Export(StatID => $StatID);
+ 
+     # the following line are because of different spelling 'ISO-8859' or 'iso-8859'
+     # but this is no solution for the problem if one string is iso and the other utf!
+     $ImportContent =~ s/^<\?xml.*?>.*?<otrs_stats/<otrs_stats/ms;
+     $ExportContent->{Content} =~ s/^<\?xml.*?>.*?<otrs_stats/<otrs_stats/ms;
      $Self->Is(
          $ImportContent,
          $ExportContent->{Content},
!         "Export-Importcheck - check if import file content equal export file content.\n Be careful, if it gives errors if you run OTRS with default charset uft-8,\n because the examplefile is iso-8859-1, but at my test there a no problems to compare a utf-8 string with an iso string?!\n"
      );
  }


More information about the cvs-log mailing list