Skip to content

Commit

Permalink
Update tests and fix uninitialized warnings for changes in SearchBuil…
Browse files Browse the repository at this point in the history
…der 1.82

On Oracle, all not defined CLOB fields are set to NULL now, like VARCHAR.
  • Loading branch information
sunnavy committed Apr 25, 2024
1 parent a5b80f5 commit 78a0ba1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions lib/RT/Action/UserDefined.pm
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ This happens on every transaction. it's always applicable

sub Prepare {
my $self = shift;
my $retval = eval $self->ScripObj->CustomPrepareCode;
my $retval = eval( $self->ScripObj->CustomPrepareCode // '' );
if ($@) {
$RT::Logger->error("Scrip ".$self->ScripObj->Id. " Prepare failed: ".$@);
return (undef);
Expand All @@ -76,7 +76,7 @@ This happens on every transaction. it's always applicable

sub Commit {
my $self = shift;
my $retval = eval $self->ScripObj->CustomCommitCode;
my $retval = eval( $self->ScripObj->CustomCommitCode // '' );
if ($@) {
$RT::Logger->error("Scrip ".$self->ScripObj->Id. " Commit failed: ".$@);
return (undef);
Expand Down
17 changes: 13 additions & 4 deletions t/rest2/customfields.t
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ my $freeform_cf_id;
Type => 'Freeform',
LookupType => 'RT::Queue-RT::Ticket',
MaxValues => 1,
Pattern => '(?#Mandatory).',
};
my $res = $mech->post_json("$rest_base_path/customfield",
$payload,
Expand Down Expand Up @@ -157,7 +158,9 @@ my $freeform_cf_id;
is($content->{MaxValues}, 1);
is($content->{Disabled}, 0);

my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
my @fields = qw(SortOrder Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
# Pattern is undef by default on Oralce and thus excluded from the response
push @fields, 'Pattern' unless RT->Config->Get('DatabaseType') eq 'Oracle';
ok(exists $content->{$_}, "got $_") for @fields;

my $links = $content->{_hyperlinks};
Expand Down Expand Up @@ -189,7 +192,9 @@ my $freeform_cf_id;
is($content->{MaxValues}, 1);
is($content->{Disabled}, 0);

my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
my @fields = qw(SortOrder Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
# Pattern is undef by default on Oralce and thus excluded from the response
push @fields, 'Pattern' unless RT->Config->Get('DatabaseType') eq 'Oracle';
ok(exists $content->{$_}, "got $_") for @fields;

my $links = $content->{_hyperlinks};
Expand Down Expand Up @@ -228,7 +233,9 @@ my $freeform_cf_id;
is($content->{MaxValues}, 1);
is($content->{Disabled}, 0);

my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
my @fields = qw(SortOrder Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
# Pattern is undef by default on Oralce and thus excluded from the response
push @fields, 'Pattern' unless RT->Config->Get('DatabaseType') eq 'Oracle';
ok(exists $content->{$_}, "got $_") for @fields;

my $links = $content->{_hyperlinks};
Expand Down Expand Up @@ -260,7 +267,9 @@ my $freeform_cf_id;
is($content->{MaxValues}, 1);
is($content->{Disabled}, 0);

my @fields = qw(SortOrder Pattern Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
my @fields = qw(SortOrder Created Creator LastUpdated LastUpdatedBy UniqueValues EntryHint);
# Pattern is undef by default on Oralce and thus excluded from the response
push @fields, 'Pattern' unless RT->Config->Get('DatabaseType') eq 'Oracle';
ok(exists $content->{$_}, "got $_") for @fields;

my $links = $content->{_hyperlinks};
Expand Down

0 comments on commit 78a0ba1

Please sign in to comment.