File: interface_web.t

package info (click to toggle)
request-tracker5 5.0.3%2Bdfsg-3~deb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 77,648 kB
  • sloc: javascript: 187,930; perl: 79,061; sh: 1,302; makefile: 471; python: 37; php: 15
file content (43 lines) | stat: -rw-r--r-- 1,085 bytes parent folder | download | duplicates (6)
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
use strict;
use warnings;

use RT::Test nodb => 1, tests => 5;
use Test::Warn;
use RT::Interface::Web; # This gets us HTML::Mason::Commands

{
    my $cf = 2;
    my %args = (
        'GroupingName' => {
            'Value'       => "bar",
            'Value-Magic' => 1
        },
    );

    my ($ret, $grouping) = HTML::Mason::Commands::_ValidateConsistentCustomFieldValues($cf, \%args);

    ok ( $ret, 'No duplicates found');
    is ( $grouping, 'GroupingName', 'Grouping is GroupingName');
}

{
    my $cf = 2;
    my %args = (
        'GroupingName'    => {
            'Value'       => "foo",
            'Value-Magic' => 1
        },
        'AnotherGrouping' => {
            'Value'       => "bar",
            'Value-Magic' => 1
        },
    );

    my ($ret, $grouping);
    warning_like {
        ($ret, $grouping) = HTML::Mason::Commands::_ValidateConsistentCustomFieldValues($cf, \%args);
    } qr/^CF 2 submitted with multiple differing values/i;

    ok ( !$ret, 'Caught duplicate values');
    is ( $grouping, 'AnotherGrouping', 'Defaulted to AnotherGrouping');
}