+
+{
+
+my @warnings;
+local $SIG{__WARN__} = sub {
+ push @warnings, "@_";
+};
+
+RT::Interface::Email::Gateway(\%args);
+
+TODO: {
+ local $TODO =
+'need a better approach of encoding converter, should be fixed in 4.2';
+ok( @warnings == 1 || @warnings == 2, "1 or 2 warnings are ok" );
+ok( @warnings == 1 || ( @warnings == 2 && $warnings[1] eq $warnings[0] ),
+ 'if there are 2 warnings, they should be same' );
+
+like(
+ $warnings[0],
+ qr/\QEncoding error: "\x{041f}" does not map to iso-8859-1/,
+"The badly formed Russian spam we have isn't actually well-formed UTF8, which makes Encode (correctly) warn",
+);
+
+}
+}
+
+ $tickets = RT::Tickets->new(RT->SystemUser);