File: single_values.t

package info (click to toggle)
request-tracker4 4.2.8-3%2Bdeb8u3
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 49,260 kB
  • ctags: 5,200
  • sloc: perl: 54,880; sh: 1,067; makefile: 499
file content (36 lines) | stat: -rw-r--r-- 907 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
use warnings;
use strict;

use RT;
use RT::Test nodata => 1, tests => 8;



my $q = RT::Queue->new(RT->SystemUser);
my ($id,$msg) =$q->Create(Name => "CF-Single-".$$);
ok($id,$msg);

my $cf = RT::CustomField->new(RT->SystemUser);
($id,$msg) = $cf->Create(Name => 'Single-'.$$, Type => 'Select', MaxValues => '1', Queue => $q->id);
ok($id,$msg);


($id,$msg) =$cf->AddValue(Name => 'First');
ok($id,$msg);

($id,$msg) =$cf->AddValue(Name => 'Second');
ok($id,$msg);


my $t = RT::Ticket->new(RT->SystemUser);
($id,undef,$msg) = $t->Create(Queue => $q->id,
          Subject => 'CF Test');

ok($id,$msg);
is($t->CustomFieldValues($cf->id)->Count, 0, "No values yet");
$t->AddCustomFieldValue(Field => $cf->id, Value => 'First');
is($t->CustomFieldValues($cf->id)->Count, 1, "One now");

$t->AddCustomFieldValue(Field => $cf->id, Value => 'Second');
is($t->CustomFieldValues($cf->id)->Count, 1, "Still one");