RT 4.0.22
[freeside.git] / rt / t / web / cf_values_class.t
1 use strict;
2 use warnings;
3
4 use RT::Test tests => 8;
5
6 use constant VALUES_CLASS => 'RT::CustomFieldValues::Groups';
7 RT->Config->Set(CustomFieldValuesSources => VALUES_CLASS);
8
9 my ($baseurl, $m) = RT::Test->started_ok;
10 ok $m->login, 'logged in as root';
11
12 my $cf_name = 'test values class';
13
14 my $cfid;
15 diag "Create a CF";
16 {
17     $m->follow_link( id => 'tools-config-custom-fields-create');
18     $m->submit_form(
19         form_name => "ModifyCustomField",
20         fields => {
21             Name          => $cf_name,
22             TypeComposite => 'Select-1',
23             LookupType    => 'RT::Queue-RT::Ticket',
24         },
25     );
26     $m->content_contains('Object created', 'created Select-1' );
27     $cfid = $m->form_name('ModifyCustomField')->value('id');
28     ok $cfid, "found id of the CF in the form, it's #$cfid";
29 }
30
31 diag "change to external values class";
32 {
33     $m->submit_form(
34         form_name => "ModifyCustomField",
35         fields    => { ValuesClass => 'RT::CustomFieldValues::Groups', },
36         button    => 'Update',
37     );
38     $m->content_contains(
39         "Field values source changed from 'RT::CustomFieldValues' to 'RT::CustomFieldValues::Groups'",
40         'changed to external values class' );
41 }
42
43 diag "change to internal values class";
44 {
45     $m->submit_form(
46         form_name => "ModifyCustomField",
47         fields    => { ValuesClass => 'RT::CustomFieldValues', },
48         button    => 'Update',
49     );
50     $m->content_contains(
51         "Field values source changed from 'RT::CustomFieldValues::Groups' to 'RT::CustomFieldValues'",
52         'changed to internal values class' );
53 }
54