5 use RT::Test nodata => 1, tests => 8;
9 my $q = RT::Queue->new(RT->SystemUser);
10 my ($id,$msg) =$q->Create(Name => "CF-Single-".$$);
13 my $cf = RT::CustomField->new(RT->SystemUser);
14 ($id,$msg) = $cf->Create(Name => 'Single-'.$$, Type => 'Select', MaxValues => '1', Queue => $q->id);
18 ($id,$msg) =$cf->AddValue(Name => 'First');
21 ($id,$msg) =$cf->AddValue(Name => 'Second');
25 my $t = RT::Ticket->new(RT->SystemUser);
26 ($id,undef,$msg) = $t->Create(Queue => $q->id,
27 Subject => 'CF Test');
30 is($t->CustomFieldValues($cf->id)->Count, 0, "No values yet");
31 $t->AddCustomFieldValue(Field => $cf->id, Value => 'First');
32 is($t->CustomFieldValues($cf->id)->Count, 1, "One now");
34 $t->AddCustomFieldValue(Field => $cf->id, Value => 'Second');
35 is($t->CustomFieldValues($cf->id)->Count, 1, "Still one");