Skip to content

Commit

Permalink
Issue #2637: Replaced ticket ids with actual ticket description as us…
Browse files Browse the repository at this point in the history
…ed in DF Ticket driver to check against.
  • Loading branch information
stefanhaerter committed Dec 28, 2023
1 parent b19f37b commit 9c0c28b
Showing 1 changed file with 44 additions and 18 deletions.
62 changes: 44 additions & 18 deletions scripts/test/DynamicField/ReadableValueRender.t
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ my $SecondCustomerUserName = $CustomerUserObject->CustomerName(
UserLogin => $SecondCustomerUserLogin,
);

# prepare information for building ticket description
my $ParamHook = $Kernel::OM->Get('Kernel::Config')->Get('Ticket::Hook') || 'Ticket#';
$ParamHook .= $Kernel::OM->Get('Kernel::Config')->Get('Ticket::HookDivider') || '';

# create a source ticket
my $SourceTicketID = $TicketObject->TicketCreate(
Title => 'Some Ticket Title',
Expand Down Expand Up @@ -153,6 +157,17 @@ my $FirstReferenceTicketID = $TicketObject->TicketCreate(
);
$Self->True( $FirstReferenceTicketID, 'Creation of first reference ticket' );

# create ticket description
my %FirstReferenceTicket = $TicketObject->TicketGet(
TicketID => $FirstReferenceTicketID,
UserID => $UserID,
);

my %FirstReferenceTicketDescription = (
Normal => $ParamHook . "$FirstReferenceTicket{TicketNumber}",
Long => $ParamHook . "$FirstReferenceTicket{TicketNumber}: $FirstReferenceTicket{Title}",
);

my $SecondReferenceTicketID = $TicketObject->TicketCreate(
Title => 'Some Ticket Title',
Queue => 'Raw',
Expand All @@ -166,6 +181,17 @@ my $SecondReferenceTicketID = $TicketObject->TicketCreate(
);
$Self->True( $SecondReferenceTicketID, 'Creation of second reference ticket' );

# create ticket description
my %SecondReferenceTicket = $TicketObject->TicketGet(
TicketID => $SecondReferenceTicketID,
UserID => $UserID,
);

my %SecondReferenceTicketDescription = (
Normal => $ParamHook . "$SecondReferenceTicket{TicketNumber}",
Long => $ParamHook . "$SecondReferenceTicket{TicketNumber}: $SecondReferenceTicket{Title}",
);

# theres is not really needed to add the dynamic fields for this test, we can define a static
# set of configurations
my %DynamicFieldConfigs = (
Expand Down Expand Up @@ -1282,8 +1308,8 @@ my @Tests = (
Value => $FirstReferenceTicketID,
},
ExpectedResults => {
Value => $FirstReferenceTicketID,
Title => $FirstReferenceTicketID,
Value => $FirstReferenceTicketDescription{Long},
Title => $FirstReferenceTicketDescription{Long},
},
Success => 1,
},
Expand All @@ -1294,8 +1320,8 @@ my @Tests = (
Value => [$FirstReferenceTicketID],
},
ExpectedResults => {
Value => $FirstReferenceTicketID,
Title => $FirstReferenceTicketID,
Value => $FirstReferenceTicketDescription{Long},
Title => $FirstReferenceTicketDescription{Long},
},
Success => 1,
},
Expand Down Expand Up @@ -1332,8 +1358,8 @@ my @Tests = (
Value => $FirstReferenceTicketID,
},
ExpectedResults => {
Value => $FirstReferenceTicketID,
Title => $FirstReferenceTicketID,
Value => $FirstReferenceTicketDescription{Long},
Title => $FirstReferenceTicketDescription{Long},
},
Success => 1,
},
Expand All @@ -1344,8 +1370,8 @@ my @Tests = (
Value => [$FirstReferenceTicketID],
},
ExpectedResults => {
Value => $FirstReferenceTicketID,
Title => $FirstReferenceTicketID,
Value => $FirstReferenceTicketDescription{Long},
Title => $FirstReferenceTicketDescription{Long},
},
Success => 1,
},
Expand All @@ -1356,8 +1382,8 @@ my @Tests = (
Value => [ $FirstReferenceTicketID, $SecondReferenceTicketID ],
},
ExpectedResults => {
Value => "$FirstReferenceTicketID, $SecondReferenceTicketID",
Title => "$FirstReferenceTicketID, $SecondReferenceTicketID",
Value => "$FirstReferenceTicketDescription{Long}, $SecondReferenceTicketDescription{Long}",
Title => "$FirstReferenceTicketDescription{Long}, $SecondReferenceTicketDescription{Long}",
},
Success => 1,
},
Expand Down Expand Up @@ -1394,8 +1420,8 @@ my @Tests = (
Value => $FirstReferenceTicketID,
},
ExpectedResults => {
Value => $FirstReferenceTicketID,
Title => $FirstReferenceTicketID,
Value => $FirstReferenceTicketDescription{Long},
Title => $FirstReferenceTicketDescription{Long},
},
Success => 1,
},
Expand All @@ -1406,8 +1432,8 @@ my @Tests = (
Value => [$FirstReferenceTicketID],
},
ExpectedResults => {
Value => $FirstReferenceTicketID,
Title => $FirstReferenceTicketID,
Value => $FirstReferenceTicketDescription{Long},
Title => $FirstReferenceTicketDescription{Long},
},
Success => 1,
},
Expand All @@ -1418,8 +1444,8 @@ my @Tests = (
Value => [ $FirstReferenceTicketID, $SecondReferenceTicketID ],
},
ExpectedResults => {
Value => "$FirstReferenceTicketID, $SecondReferenceTicketID",
Title => "$FirstReferenceTicketID, $SecondReferenceTicketID",
Value => "$FirstReferenceTicketDescription{Long}, $SecondReferenceTicketDescription{Long}",
Title => "$FirstReferenceTicketDescription{Long}, $SecondReferenceTicketDescription{Long}",
},
Success => 1,
},
Expand All @@ -1442,8 +1468,8 @@ my @Tests = (
Value => [ $FirstReferenceTicketID, undef, $SecondReferenceTicketID ],
},
ExpectedResults => {
Value => "$FirstReferenceTicketID, , $SecondReferenceTicketID",
Title => "$FirstReferenceTicketID, , $SecondReferenceTicketID",
Value => "$FirstReferenceTicketDescription{Long}, , $SecondReferenceTicketDescription{Long}",
Title => "$FirstReferenceTicketDescription{Long}, , $SecondReferenceTicketDescription{Long}",
},
Success => 1,
},
Expand Down

0 comments on commit 9c0c28b

Please sign in to comment.