@@ -6,6 +6,8 @@ use RT::Test tests => undef, config => 'Set($EnableJSChart, 0);';
66plan skip_all => ' GD required'
77 unless RT::StaticUtil::RequireModule(" GD" );
88
9+ my $core_group = RT::Test-> load_or_create_group(' core team' );
10+
911for my $n (1..7) {
1012 my $ticket = RT::Ticket-> new( RT-> SystemUser );
1113 my $req = ' root' . ($n % 2) . ' @localhost' ;
@@ -14,6 +16,9 @@ for my $n (1..7) {
1416 Queue => " General" ,
1517 Owner => " root" ,
1618 Requestor => $req ,
19+ AdminCc => [ $req , $core_group -> Id ],
20+ Starts => ' 2022-12-10 00:00:00' ,
21+ Started => ' 2022-12-11 00:00:00' ,
1722 MIMEObj => MIME::Entity-> build(
1823 From => $req ,
1924 To => ' rt@localhost' ,
@@ -77,6 +82,31 @@ $m->warning_like( qr{'Requestor\.Phone' is not a valid grouping for reports} );
7782is( $m -> content_type, " image/png" );
7883ok( length ($m -> content), " Has content" );
7984
85+ # Group by AdminCc name
86+ $m -> get_ok(" /Search/Chart.html?Query=id>0&GroupBy=AdminCc.Name" );
87+ $m -> content_like( qr { <th[^>]*>AdminCc\s +Name</th>\s *<th[^>]*>Ticket count\s *</th>} , " Grouped by AdminCc" );
88+ $m -> content_like( qr { Group: core team\s *</th>\s *<td[^>]*>\s *<a[^>]*>7</a>} , " Found group results in table" );
89+ $m -> content_like( qr { root0\@ localhost\s *</th>\s *<td[^>]*>\s *<a[^>]*>3</a>} , " Found results in table" );
90+ $m -> content_like( qr { <img src="/Search/Chart\? } , " Found image" );
91+
92+ $m -> get_ok(" /Search/Chart?Query=id>0&GroupBy=AdminCc.Name" );
93+ is( $m -> content_type, " image/png" );
94+ ok( length ( $m -> content ), " Has content" );
95+
96+ # Group by AdminCc name and duration, which is calculated in perl instead of db.
97+ $m -> get_ok(" /Search/Chart.html?Query=id>0&GroupBy=AdminCc.Name&GroupBy=Starts+to+Started.Default" );
98+ $m -> content_like(
99+ qr { <th[^>]*>AdminCc\s +Name</th>\s *<th[^>]*>Starts to Started Default\s *</th>\s *<th[^>]*>Ticket count\s *</th>} ,
100+ " Grouped by AdminCc and Starts to Started" );
101+ $m -> content_like( qr { Group: core team\s *</th>\s *<th[^>]*>24 hours</th>\s *<td[^>]*>\s *<a[^>]*>7</a>} ,
102+ " Found group results in table" );
103+ $m -> content_like( qr { root0\@ localhost\s *</th>\s *<td[^>]*>\s *<a[^>]*>3</a>} , " Found results in table" );
104+ $m -> content_like( qr { <img src="/Search/Chart\? } , " Found image" );
105+
106+ $m -> get_ok(" /Search/Chart?Query=id>0&GroupBy=AdminCc.Name&GroupBy=Starts+to+Started.Default" );
107+ is( $m -> content_type, " image/png" );
108+ ok( length ( $m -> content ), " Has content" );
109+
80110diag " Confirm subnav links use Query param before saved search in session." ;
81111
82112$m -> get_ok( " /Search/Chart.html?Query=id>0" );
0 commit comments