summaryrefslogtreecommitdiff
path: root/rt/t/web/cf_values_class.t
blob: 6466427819cb2d5affda7d92e7235c43685a9c70 (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use strict;
use warnings;

use RT::Test tests => 8;

use constant VALUES_CLASS => 'RT::CustomFieldValues::Groups';
RT->Config->Set(CustomFieldValuesSources => VALUES_CLASS);

my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, 'logged in as root';

my $cf_name = 'test values class';

my $cfid;
diag "Create a CF";
{
    $m->follow_link( id => 'tools-config-custom-fields-create');
    $m->submit_form(
        form_name => "ModifyCustomField",
        fields => {
            Name          => $cf_name,
            TypeComposite => 'Select-1',
            LookupType    => 'RT::Queue-RT::Ticket',
        },
    );
    $m->content_contains('Object created', 'created Select-1' );
    $cfid = $m->form_name('ModifyCustomField')->value('id');
    ok $cfid, "found id of the CF in the form, it's #$cfid";
}

diag "change to external values class";
{
    $m->submit_form(
        form_name => "ModifyCustomField",
        fields    => { ValuesClass => 'RT::CustomFieldValues::Groups', },
        button    => 'Update',
    );
    $m->content_contains(
        "Field values source changed from 'RT::CustomFieldValues' to 'RT::CustomFieldValues::Groups'",
        'changed to external values class' );
}

diag "change to internal values class";
{
    $m->submit_form(
        form_name => "ModifyCustomField",
        fields    => { ValuesClass => 'RT::CustomFieldValues', },
        button    => 'Update',
    );
    $m->content_contains(
        "Field values source changed from 'RT::CustomFieldValues::Groups' to 'RT::CustomFieldValues'",
        'changed to internal values class' );
}