4 use RT::Test no_plan => 1;
7 my $ticket = RT::Ticket->new( RT->SystemUser );
8 my $req = 'root' . ($n % 2) . '@localhost';
9 my ( $ret, $msg ) = $ticket->Create(
10 Subject => "base ticket $_",
14 MIMEObj => MIME::Entity->build(
17 Subject => "base ticket $_",
21 ok( $ret, "ticket $n created: $msg" );
24 my ($url, $m) = RT::Test->started_ok;
25 ok( $m->login, "Logged in" );
27 # Test that defaults work
28 $m->get_ok( "/Search/Chart.html?Query=id>0" );
29 $m->content_like(qr{<th[^>]*>\s*Queue\s*</th>\s*<th[^>]*>\s*Tickets\s*</th>}, "Grouped by queue");
30 $m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*7}, "Found results in table");
31 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
33 $m->get_ok( "/Search/Chart?Query=id>0" );
34 is( $m->content_type, "image/png" );
35 ok( length($m->content), "Has content" );
39 $m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Queue" );
40 $m->content_like(qr{<th[^>]*>\s*Queue\s*</th>\s*<th[^>]*>\s*Tickets\s*</th>}, "Grouped by queue");
41 $m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*7}, "Found results in table");
42 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
44 $m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Queue" );
45 is( $m->content_type, "image/png" );
46 ok( length($m->content), "Has content" );
49 # Group by Requestor email
50 $m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Requestor.EmailAddress" );
51 $m->content_like(qr{<th[^>]*>\s*Requestor\.EmailAddress\s*</th>\s*<th[^>]*>\s*Tickets\s*</th>},
52 "Grouped by requestor");
53 $m->content_like(qr{root0\@localhost</a>\s*</td>\s*<td[^>]*>\s*3}, "Found results in table");
54 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
56 $m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Email" );
57 is( $m->content_type, "image/png" );
58 ok( length($m->content), "Has content" );
61 # Group by Requestor phone -- which is bogus, and falls back to queue
62 $m->get_ok( "/Search/Chart.html?Query=id>0&PrimaryGroupBy=Requestor.Phone" );
63 $m->content_like(qr{General</a>\s*</td>\s*<td[^>]*>\s*7},
64 "Found queue results in table, as a default");
65 $m->content_like(qr{<img src="/Search/Chart\?}, "Found image");
67 $m->get_ok( "/Search/Chart?Query=id>0&PrimaryGroupBy=Requestor.Phone" );
68 is( $m->content_type, "image/png" );
69 ok( length($m->content), "Has content" );