summaryrefslogtreecommitdiff
path: root/rt/t/web/ticket-create-utf8.t
blob: a4d7ae98de47aaf20e237e3b1289b53720bf89cb (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/perl

use strict;
use warnings;

use RT::Test tests => 14;

$RT::Test::SKIP_REQUEST_WORK_AROUND = 1;

use Encode;

my $ru_test = "\x{442}\x{435}\x{441}\x{442}";
my $ru_autoreply = "\x{410}\x{432}\x{442}\x{43e}\x{43e}\x{442}\x{432}\x{435}\x{442}";
my $ru_support = "\x{43f}\x{43e}\x{434}\x{434}\x{435}\x{440}\x{436}\x{43a}\x{430}";

my $q = RT::Test->load_or_create_queue( Name => 'Regression' );
ok $q && $q->id, 'loaded or created queue';

RT::Test->set_rights(
    Principal => 'Everyone',
    Right => ['CreateTicket', 'ShowTicket', 'SeeQueue', 'ReplyToTicket', 'ModifyTicket'],
);

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

# create a ticket with a subject only
{
    ok $m->goto_create_ticket( $q ), "go to create ticket";
    $m->form_number(3);
    $m->field( Subject => $ru_test );
    $m->submit;

    $m->content_like( 
        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
        'header on the page'
    );

    my $ticket = RT::Test->last_ticket;
    is $ticket->Subject, $ru_test, "correct subject";
}

# create a ticket with a subject and content
{
    ok $m->goto_create_ticket( $q ), "go to create ticket";
    $m->form_number(3);
    $m->field( Subject => $ru_test );
    $m->field( Content => $ru_support );
    $m->submit;

    $m->content_like( 
        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
        'header on the page'
    );
    $m->content_like( 
        qr{\Q$ru_support\E}i,
        'content on the page'
    );

    my $ticket = RT::Test->last_ticket;
    is $ticket->Subject, $ru_test, "correct subject";
}

# create a ticket with a subject and content
{
    ok $m->goto_create_ticket( $q ), "go to create ticket";
    $m->form_number(3);
    $m->field( Subject => $ru_test );
    $m->field( Content => $ru_support );
    $m->submit;

    $m->content_like( 
        qr{<td\s+class="message-header-value"[^>]*>\s*\Q$ru_test\E\s*</td>}i,
        'header on the page'
    );
    $m->content_like( 
        qr{\Q$ru_support\E}i,
        'content on the page'
    );

    my $ticket = RT::Test->last_ticket;
    is $ticket->Subject, $ru_test, "correct subject";
}