rt 4.2.14 (#13852)
[freeside.git] / rt / t / mail / dashboard-chart-with-utf8.t
index 79f5f0e..4fe483a 100644 (file)
@@ -1,18 +1,10 @@
 use strict;
 use warnings;
 
-BEGIN {
-    require RT::Test;
+use RT::Test tests => undef;
 
-    if (eval { require GD }) {
-        RT::Test->import(tests => 15);
-    }
-    else {
-        RT::Test->import(skip_all => 'GD required.');
-    }
-}
-
-use utf8;
+plan skip_all => 'GD required'
+    unless GD->require;
 
 my $root = RT::Test->load_or_create_user( Name => 'root' );
 
@@ -21,16 +13,17 @@ ok( $m->login, 'logged in' );
 my $ticket = RT::Ticket->new( $RT::SystemUser );
 $ticket->Create(
     Queue   => 'General',
-    Subject => 'test äöü',
+    Subject => Encode::decode("UTF-8",'test äöü'),
 );
 ok( $ticket->id, 'created ticket' );
 
-$m->get_ok(q{/Search/Chart.html?Query=Subject LIKE 'test äöü'});
+$m->get_ok(Encode::decode("UTF-8", q{/Search/Chart.html?Query=Subject LIKE 'test äöü'}));
 $m->submit_form(
     form_name => 'SaveSearch',
     fields    => {
         SavedSearchDescription => 'chart foo',
         SavedSearchOwner       => 'RT::User-' . $root->id,
+        ChartStyle             => 'bar',
     },
     button => 'SavedSearchSave',
 );
@@ -58,7 +51,7 @@ $m->field( 'Hour'      => '06:00' );
 $m->click_button( name => 'Save' );
 $m->content_contains('Subscribed to dashboard dashboard foo');
 
-my $c     = $m->get(q{/Search/Chart?Query=Subject LIKE 'test äöü'});
+my $c     = $m->get(Encode::decode("UTF-8",q{/Search/Chart?Query=Subject LIKE 'test äöü'}));
 my $image = $c->content;
 RT::Test->run_and_capture(
     command => $RT::SbinPath . '/rt-email-dashboards', all => 1
@@ -90,3 +83,5 @@ if ( my $io = $handle->open('r') ) {
 }
 is( $mail_image_data, $image, 'image in mail is the same one in web' );
 
+undef $m;
+done_testing;