[otrs-cvs] otrs/scripts/test/ProcessManagement/DB/Process ProcessDump.t, 1.5, 1.6

"CVS commits notifications of OTRS.org" <[email protected]>
Newsgroups gmane.comp.otrs.cvs
Message-ID <[email protected]>
Comments:
Update of /home/cvs/otrs/scripts/test/ProcessManagement/DB/Process
In directory lancelot:/tmp/cvs-serv17647/scripts/test/ProcessManagement/DB/Process

Modified Files:
	ProcessDump.t 
Log Message:
Added more tests.

Author: cr

Index: ProcessDump.t
===================================================================
RCS file: /home/cvs/otrs/scripts/test/ProcessManagement/DB/Process/ProcessDump.t,v
retrieving revision 1.5
retrieving revision 1.6
diff -2 -u -d -r1.5 -r1.6
--- ProcessDump.t	20 Nov 2012 16:11:48 -0000	1.5
+++ ProcessDump.t	11 Jan 2013 04:40:55 -0000	1.6
@@ -1,5 +1,5 @@
 # --
 # ProcessDump.t - ProcessManagement DB ProcessDump tests
-# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
+# Copyright (C) 2001-2013 OTRS AG, http://otrs.org/
 # --
 # $Id$
@@ -211,4 +211,16 @@
                     },
                     DynamicField_VWModell => ['1'],
+                    DynamicField_Regex    => {
+                        Type  => 'Regexp',
+                        Match => 'My[ ]Regexp',
+                    },
+                    DynamicField_Regex2 => {
+                        Type  => 'Regexp',
+                        Match => qr{.*}msx,
+                    },
+                    DynamicField_String => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
                 },
             },
@@ -217,4 +229,26 @@
                 DynamicField_PeugeotModell => ['1'],
             },
+            Cond3 => {
+                Type   => 'and',
+                Fields => {
+                    DynamicField_Marke => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
+                    DynamicField_VWModell => ['1'],
+                    DynamicField_Regex    => {
+                        Type  => 'Regexp',
+                        Match => '.*',
+                    },
+                    DynamicField_Regex2 => {
+                        Type  => 'Regexp',
+                        Match => qr{.*}msx,
+                    },
+                    DynamicField_String => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
+                },
+            },
         },
     },
@@ -247,24 +281,124 @@
 );
 
+my $ExpectedResult;
+
+$ExpectedResult->{Transition} = {
+    'T-Test1' => {
+        Name      => 'Transition 1',
+        Condition => {
+            Type  => 'and',
+            Cond1 => {
+                Type   => 'and',
+                Fields => {
+                    DynamicField_Marke => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
+                    DynamicField_VWModell => ['1'],
+                    DynamicField_Regex    => {
+                        Type  => 'Regexp',
+                        Match => '(?msx-i:My[ ]Regexp)',
+                    },
+                    DynamicField_Regex2 => {
+                        Type  => 'Regexp',
+                        Match => qr{.*}msx,
+                    },
+                    DynamicField_String => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
+                },
+            },
+            Cond2 => {
+                DynamicField_Marke         => ['2'],
+                DynamicField_PeugeotModell => ['1'],
+            },
+            Cond3 => {
+                Type   => 'and',
+                Fields => {
+                    DynamicField_Marke => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
+                    DynamicField_VWModell => ['1'],
+                    DynamicField_Regex    => {
+                        Type  => 'Regexp',
+                        Match => '(?msx-i:.*)',
+                    },
+                    DynamicField_Regex2 => {
+                        Type  => 'Regexp',
+                        Match => qr{.*}msx,
+                    },
+                    DynamicField_String => {
+                        Type  => 'String',
+                        Match => 'Teststring',
+                    },
+                },
+            },
+        },
+    },
+};
+
 # actual tests
 my $ConfigHash = $ProcessObject->ProcessDump(
-    ResultType => 'HASH',
-    UserID     => 1
+    ResultType  => 'HASH',
+    QuoteRegexp => 1,
+    UserID      => 1,
 );
 
-$Self->IsNotDeeply(
-    $ConfigHash,
-    {},
-    "ProcessDump() | Output is not emtpy hash",
+$Self->Is(
+    ref $ConfigHash,
+    'HASH',
+    "ProcessDump() HASH | Output is a hash",
 );
 
-my $Output = $ProcessObject->ProcessDump( UserID => $UserID );
+# remove elements for easy compare
+delete $ConfigHash->{Transition}->{'T-Test1'}->{CreateTime};
+delete $ConfigHash->{Transition}->{'T-Test1'}->{ChangeTime};
+
+$Self->IsDeeply(
+    $ConfigHash->{Transition}->{'T-Test1'},
+    $ExpectedResult->{Transition}->{'T-Test1'},
+    "ProcessDump() HASH | Transition Expected result",
+);
+
+my $Output = $ProcessObject->ProcessDump(
+    QuoteRegexp => 1,
+    UserID      => $UserID,
+);
 
 $Self->IsNot(
-    $Output,
-    undef,
-    "ProcessDump() | Output is not undef",
+    length $Output,
+    0,
+    "ProcessDump() STRING | Output lenght",
 );
 
+for my $Part (
+    qw(
+    Process Process::Activity Process::ActivityDialog Process::Transition Process::TransitionAction
+    )
+    )
+{
+    my $Success;
+    if ( $Output =~ m{ \$Self->\{ '$Part' \} \s+?  = \s+? \{ }msx ) {
+        $Success = 1;
+    }
+    $Self->True(
+        $Success,
+        "ProcessDump() STRING | contains \$Self->{$Part} = { with True",
+    );
+}
+
+for my $Entity (qw(P-Test1 A-Test1 AD-Test1 T-Test1 TA-Test1)) {
+    my $Success;
+    if ( $Output =~ m{'$Entity' \s+? =\> \s+? \{ }msx ) {
+        $Success = 1;
+    }
+    $Self->True(
+        $Success,
+        "ProcessDump() STRING | contains $Entity => { with True",
+    );
+}
+
 # clean the system
 my $Success = $ProcessObject->ProcessDelete(
---------------------------------------------------------------------
OTRS mailing list: cvs-log - Webpage: http://otrs.org/
Archive: http://lists.otrs.org/pipermail/cvs-log
To unsubscribe: http://lists.otrs.org/cgi-bin/listinfo/cvs-log
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.