summaryrefslogtreecommitdiff
path: root/rt/t
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t')
-rw-r--r--rt/t/00-mason-syntax.t2
-rw-r--r--rt/t/api/attachment_filename.t2
-rw-r--r--rt/t/api/cf_rights.t1
-rw-r--r--rt/t/api/cron.t3
-rw-r--r--rt/t/api/date.t4
-rw-r--r--rt/t/api/group.t17
-rw-r--r--rt/t/api/i18n_guess.t1
-rw-r--r--rt/t/api/password-types.t1
-rw-r--r--rt/t/api/rights.t49
-rw-r--r--rt/t/api/rights_show_ticket.t1
-rw-r--r--rt/t/api/rtname.t1
-rw-r--r--rt/t/api/safe-run-child-util.t2
-rw-r--r--rt/t/api/scrip_order.t2
-rw-r--r--rt/t/api/squish.t11
-rw-r--r--rt/t/api/ticket.t31
-rw-r--r--rt/t/api/versions_sorter.t1
-rw-r--r--rt/t/articles/article.t1
-rw-r--r--rt/t/articles/articles.t1
-rw-r--r--rt/t/articles/basic-api.t1
-rw-r--r--rt/t/articles/cfsearch.t1
-rw-r--r--rt/t/articles/class.t17
-rw-r--r--rt/t/articles/interface.t5
-rw-r--r--rt/t/articles/queue-specific-class.t3
-rw-r--r--rt/t/articles/search-interface.t3
-rw-r--r--rt/t/articles/upload-customfields.t1
-rw-r--r--rt/t/articles/uri-a.t1
-rw-r--r--rt/t/articles/uri-articles.t1
-rw-r--r--rt/t/customfields/access_via_queue.t30
-rw-r--r--rt/t/customfields/api.t28
-rw-r--r--rt/t/customfields/combo_cascade.t1
-rw-r--r--rt/t/customfields/date_search.t75
-rw-r--r--rt/t/customfields/datetime_search.t106
-rw-r--r--rt/t/customfields/external.t9
-rw-r--r--rt/t/customfields/ip.t11
-rw-r--r--rt/t/customfields/iprange.t1
-rw-r--r--rt/t/customfields/iprangev6.t1
-rw-r--r--rt/t/customfields/ipv6.t10
-rw-r--r--rt/t/customfields/pattern.t1
-rw-r--r--rt/t/customfields/single_values.t1
-rw-r--r--rt/t/customfields/sort_order.t1
-rw-r--r--rt/t/customfields/transaction.t1
-rw-r--r--rt/t/fts/indexed_mysql.t1
-rw-r--r--rt/t/fts/indexed_oracle.t1
-rw-r--r--rt/t/fts/indexed_pg.t1
-rw-r--r--rt/t/fts/not_indexed.t1
-rw-r--r--rt/t/i18n/caching.t1
-rw-r--r--rt/t/i18n/default.t1
-rw-r--r--rt/t/i18n/footer.t1
-rw-r--r--rt/t/lifecycles/basics.t1
-rw-r--r--rt/t/lifecycles/dates.t1
-rw-r--r--rt/t/lifecycles/moving.t1
-rw-r--r--rt/t/lifecycles/unresolved-deps.t4
-rw-r--r--rt/t/lifecycles/utils.pl1
-rw-r--r--rt/t/mail/charsets-outgoing.t1
-rw-r--r--rt/t/mail/crypt-gnupg.t1
-rw-r--r--rt/t/mail/dashboards.t1
-rw-r--r--rt/t/mail/digest-attributes.t1
-rw-r--r--rt/t/mail/extractsubjecttag.t24
-rw-r--r--rt/t/mail/gateway.t55
-rw-r--r--rt/t/mail/gnupg-bad.t1
-rw-r--r--rt/t/mail/gnupg-incoming.t32
-rw-r--r--rt/t/mail/gnupg-outgoing-encrypted.t1
-rw-r--r--rt/t/mail/gnupg-outgoing-plain.t1
-rw-r--r--rt/t/mail/gnupg-outgoing-signed.t1
-rw-r--r--rt/t/mail/gnupg-outgoing-signed_encrypted.t1
-rw-r--r--rt/t/mail/gnupg-realmail.t1
-rw-r--r--rt/t/mail/gnupg-reverification.t1
-rw-r--r--rt/t/mail/gnupg-special.t1
-rw-r--r--rt/t/mail/mime_decoding.t45
-rw-r--r--rt/t/mail/multipart.t48
-rw-r--r--rt/t/mail/one-time-recipients.t1
-rw-r--r--rt/t/mail/outlook.t250
-rw-r--r--rt/t/mail/sendmail.t3
-rw-r--r--rt/t/mail/threading.t1
-rw-r--r--rt/t/mail/verp.t3
-rw-r--r--rt/t/mail/wrong_mime_charset.t1
-rw-r--r--rt/t/shredder/00load.t2
-rw-r--r--rt/t/shredder/00skeleton.t3
-rw-r--r--rt/t/shredder/01basics.t3
-rw-r--r--rt/t/shredder/01ticket.t3
-rw-r--r--rt/t/shredder/02group_member.t3
-rw-r--r--rt/t/shredder/02queue.t3
-rw-r--r--rt/t/shredder/02template.t3
-rw-r--r--rt/t/shredder/02user.t3
-rw-r--r--rt/t/shredder/03plugin.t3
-rw-r--r--rt/t/shredder/03plugin_summary.t3
-rw-r--r--rt/t/shredder/03plugin_tickets.t3
-rw-r--r--rt/t/shredder/03plugin_users.t3
-rw-r--r--rt/t/shredder/utils.pl1
-rw-r--r--rt/t/ticket/action_linear_escalate.t1
-rw-r--r--rt/t/ticket/add-watchers.t47
-rw-r--r--rt/t/ticket/badlinks.t1
-rw-r--r--rt/t/ticket/batch-upload-csv.t4
-rw-r--r--rt/t/ticket/cfsort-freeform-multiple.t1
-rw-r--r--rt/t/ticket/cfsort-freeform-single.t1
-rw-r--r--rt/t/ticket/clicky.t1
-rw-r--r--rt/t/ticket/googleish_search.t1
-rw-r--r--rt/t/ticket/link_search.t3
-rw-r--r--rt/t/ticket/merge.t1
-rw-r--r--rt/t/ticket/requestor-order.t4
-rw-r--r--rt/t/ticket/search.t12
-rw-r--r--rt/t/ticket/search_by_cf_freeform_multiple.t1
-rw-r--r--rt/t/ticket/search_by_cf_freeform_single.t1
-rw-r--r--rt/t/ticket/search_by_links.t1
-rw-r--r--rt/t/ticket/search_by_txn.t1
-rw-r--r--rt/t/ticket/search_by_watcher.t1
-rw-r--r--rt/t/ticket/search_long_cf_values.t1
-rw-r--r--rt/t/ticket/sort-by-custom-ownership.t1
-rw-r--r--rt/t/ticket/sort-by-queue.t1
-rw-r--r--rt/t/ticket/sort-by-user.t1
-rw-r--r--rt/t/ticket/sort_by_cf.t1
-rw-r--r--rt/t/validator/group_members.t1
-rw-r--r--rt/t/web/admin_groups.t1
-rw-r--r--rt/t/web/admin_user.t63
-rw-r--r--rt/t/web/attachment_encoding.t1
-rw-r--r--rt/t/web/attachments.t2
-rw-r--r--rt/t/web/basic.t1
-rw-r--r--rt/t/web/case-sensitivity.t2
-rw-r--r--rt/t/web/cf_access.t2
-rw-r--r--rt/t/web/cf_date.t1
-rw-r--r--rt/t/web/cf_datetime.t1
-rw-r--r--rt/t/web/cf_onqueue.t2
-rw-r--r--rt/t/web/cf_select_one.t1
-rw-r--r--rt/t/web/class_create.t2
-rw-r--r--rt/t/web/clickjacking-preventions.t1
-rw-r--r--rt/t/web/command_line.t18
-rw-r--r--rt/t/web/command_line_with_unknown_field.t14
-rw-r--r--rt/t/web/compilation_errors.t5
-rw-r--r--rt/t/web/config_tab_right.t1
-rw-r--r--rt/t/web/crypt-gnupg.t2
-rw-r--r--rt/t/web/csrf-rest.t1
-rw-r--r--rt/t/web/csrf.t1
-rw-r--r--rt/t/web/custom_frontpage.t23
-rw-r--r--rt/t/web/custom_search.t2
-rw-r--r--rt/t/web/dashboards-basics.t2
-rw-r--r--rt/t/web/dashboards-deleted-saved-search.t1
-rw-r--r--rt/t/web/dashboards-groups.t2
-rw-r--r--rt/t/web/dashboards-permissions.t1
-rw-r--r--rt/t/web/dashboards-search-cache.t2
-rw-r--r--rt/t/web/gnupg-headers.t2
-rw-r--r--rt/t/web/gnupg-select-keys-on-create.t1
-rw-r--r--rt/t/web/gnupg-select-keys-on-update.t1
-rw-r--r--rt/t/web/gnupg-tickyboxes.t1
-rw-r--r--rt/t/web/googleish_search.t1
-rw-r--r--rt/t/web/group_create.t2
-rw-r--r--rt/t/web/html_template.t3
-rw-r--r--rt/t/web/installer.t11
-rw-r--r--rt/t/web/logout.t1
-rw-r--r--rt/t/web/offline.t1
-rw-r--r--rt/t/web/offline_messages_utf8.t1
-rw-r--r--rt/t/web/offline_utf8.t1
-rw-r--r--rt/t/web/owner_disabled_group_19221.t1
-rw-r--r--rt/t/web/passthrough-jsmin1
-rw-r--r--rt/t/web/private-components.t1
-rw-r--r--rt/t/web/query_builder.t3
-rw-r--r--rt/t/web/query_builder_queue_limits.t16
-rw-r--r--rt/t/web/query_log.t1
-rw-r--r--rt/t/web/queue_caching.t30
-rw-r--r--rt/t/web/queue_create.t2
-rw-r--r--rt/t/web/quickcreate.t1
-rw-r--r--rt/t/web/quicksearch.t1
-rw-r--r--rt/t/web/redirect-after-login.t1
-rw-r--r--rt/t/web/redirect.t2
-rw-r--r--rt/t/web/reminders.t26
-rw-r--r--rt/t/web/requestor_groups_edit_link.t1
-rw-r--r--rt/t/web/requestor_groups_limit.t1
-rw-r--r--rt/t/web/rest-non-ascii-subject.t1
-rw-r--r--rt/t/web/rest-sort.t1
-rw-r--r--rt/t/web/rest.t181
-rw-r--r--rt/t/web/richtext-autohandler.t1
-rw-r--r--rt/t/web/rights.t1
-rw-r--r--rt/t/web/rights1.t2
-rw-r--r--rt/t/web/saved_search_chart.t1
-rw-r--r--rt/t/web/saved_search_context.t1
-rw-r--r--rt/t/web/saved_search_permissions.t1
-rw-r--r--rt/t/web/saved_search_update.t1
-rw-r--r--rt/t/web/scrips.t2
-rw-r--r--rt/t/web/scrub.t1
-rw-r--r--rt/t/web/search_bulk_update_links.t1
-rw-r--r--rt/t/web/search_rss.t3
-rw-r--r--rt/t/web/search_tabs.t4
-rw-r--r--rt/t/web/template.t35
-rw-r--r--rt/t/web/ticket-create-utf8.t1
-rw-r--r--rt/t/web/ticket_display.t14
-rw-r--r--rt/t/web/ticket_forward.t1
-rw-r--r--rt/t/web/ticket_modify_all.t4
-rw-r--r--rt/t/web/ticket_owner.t1
-rw-r--r--rt/t/web/ticket_owner_autocomplete.t1
-rw-r--r--rt/t/web/ticket_owner_issues_16656.t1
-rw-r--r--rt/t/web/ticket_seen.t1
-rw-r--r--rt/t/web/ticket_txn_content.t2
-rw-r--r--rt/t/web/ticket_update_without_content.t1
-rw-r--r--rt/t/web/unlimited_search.t3
-rw-r--r--rt/t/web/user_update.t31
-rw-r--r--rt/t/web/walk.t1
195 files changed, 1060 insertions, 562 deletions
diff --git a/rt/t/00-mason-syntax.t b/rt/t/00-mason-syntax.t
index 1221b7d17..0f77876ae 100644
--- a/rt/t/00-mason-syntax.t
+++ b/rt/t/00-mason-syntax.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/api/attachment_filename.t b/rt/t/api/attachment_filename.t
index bcbfe0057..6bfc7072f 100644
--- a/rt/t/api/attachment_filename.t
+++ b/rt/t/api/attachment_filename.t
@@ -1,3 +1,5 @@
+use strict;
+use warnings;
use RT::Test tests => 5;
use MIME::Entity;
my $ticket = RT::Ticket->new(RT->SystemUser);
diff --git a/rt/t/api/cf_rights.t b/rt/t/api/cf_rights.t
index f55214a66..e8a75c165 100644
--- a/rt/t/api/cf_rights.t
+++ b/rt/t/api/cf_rights.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/api/cron.t b/rt/t/api/cron.t
index 6f9d7f644..6bd992df3 100644
--- a/rt/t/api/cron.t
+++ b/rt/t/api/cron.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use RT;
use RT::Test nodata => 1, tests => 18;
diff --git a/rt/t/api/date.t b/rt/t/api/date.t
index 6fcaa494b..728a4a2bc 100644
--- a/rt/t/api/date.t
+++ b/rt/t/api/date.t
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
use Test::MockTime qw(set_fixed_time restore_time);
use DateTime;
-use warnings; use strict;
+use warnings;
+use strict;
use RT::Test tests => 173;
use RT::User;
use Test::Warn;
diff --git a/rt/t/api/group.t b/rt/t/api/group.t
index 3ce3da999..2c1ca73cf 100644
--- a/rt/t/api/group.t
+++ b/rt/t/api/group.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test nodata => 1, tests => 38;
+use RT::Test nodata => 1, tests => undef;
{
@@ -94,3 +94,18 @@ is($u->PrincipalObj->PrincipalType , 'Group' , "Principal 4 is a group");
}
+{
+ my $u = RT::Group->new(RT->SystemUser);
+ $u->LoadUserDefinedGroup('TestGroup');
+ ok( $u->id, 'loaded TestGroup' );
+ ok( $u->SetName('testgroup'), 'rename to lower cased version: testgroup' );
+ ok( $u->SetName('TestGroup'), 'rename back' );
+
+ my $u2 = RT::Group->new( RT->SystemUser );
+ my ( $id, $msg ) = $u2->CreateUserDefinedGroup( Name => 'TestGroup' );
+ ok( !$id, "can't create duplicated group: $msg" );
+ ( $id, $msg ) = $u2->CreateUserDefinedGroup( Name => 'testgroup' );
+ ok( !$id, "can't create duplicated group even case is different: $msg" );
+}
+
+done_testing;
diff --git a/rt/t/api/i18n_guess.t b/rt/t/api/i18n_guess.t
index 139ec1acd..956cb1505 100644
--- a/rt/t/api/i18n_guess.t
+++ b/rt/t/api/i18n_guess.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/api/password-types.t b/rt/t/api/password-types.t
index 5f253d51e..e5155e35b 100644
--- a/rt/t/api/password-types.t
+++ b/rt/t/api/password-types.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/api/rights.t b/rt/t/api/rights.t
index a1795ca0a..107fb2b35 100644
--- a/rt/t/api/rights.t
+++ b/rt/t/api/rights.t
@@ -1,52 +1,3 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
use RT::Test nodata => 1, tests => 30;
use strict;
diff --git a/rt/t/api/rights_show_ticket.t b/rt/t/api/rights_show_ticket.t
index 62f62c422..c8107fe07 100644
--- a/rt/t/api/rights_show_ticket.t
+++ b/rt/t/api/rights_show_ticket.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use RT::Test nodata => 1, tests => 264;
diff --git a/rt/t/api/rtname.t b/rt/t/api/rtname.t
index ef6092bb2..8b7b54bd1 100644
--- a/rt/t/api/rtname.t
+++ b/rt/t/api/rtname.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/api/safe-run-child-util.t b/rt/t/api/safe-run-child-util.t
index b29e97177..43b5c91db 100644
--- a/rt/t/api/safe-run-child-util.t
+++ b/rt/t/api/safe-run-child-util.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/api/scrip_order.t b/rt/t/api/scrip_order.t
index 22d3f21d1..6fba7e579 100644
--- a/rt/t/api/scrip_order.t
+++ b/rt/t/api/scrip_order.t
@@ -1,6 +1,6 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT;
use RT::Test tests => 7;
diff --git a/rt/t/api/squish.t b/rt/t/api/squish.t
index 59615368f..4b0fc5f37 100644
--- a/rt/t/api/squish.t
+++ b/rt/t/api/squish.t
@@ -1,11 +1,16 @@
use strict;
use warnings;
use RT;
-use RT::Test nodb => 1, tests => 7;
+use RT::Test nodb => 1, tests => undef;
+use Test::Warn;
use RT::Squish;
-my $squish = RT::Squish->new();
+my $squish;
+warning_like {
+ $squish = RT::Squish->new();
+} [qr/implement/], "warns this is only an abstract base class";
+
for my $method ( qw/Content ModifiedTime ModifiedTimeString Key/ ) {
can_ok($squish, $method);
}
@@ -14,3 +19,5 @@ ok( (time()-$squish->ModifiedTime) <= 2, 'ModifiedTime' );
use RT::Squish::CSS;
can_ok('RT::Squish::CSS', 'Style');
+
+done_testing;
diff --git a/rt/t/api/ticket.t b/rt/t/api/ticket.t
index 92c8a85df..da287a607 100644
--- a/rt/t/api/ticket.t
+++ b/rt/t/api/ticket.t
@@ -2,7 +2,7 @@
use strict;
use warnings;
use RT;
-use RT::Test tests => 87;
+use RT::Test tests => undef;
{
@@ -254,3 +254,32 @@ ok(!$id,$msg);
}
+diag("Test ticket types with different cases");
+{
+ my $t = RT::Ticket->new(RT->SystemUser);
+ my ($ok) = $t->Create(
+ Queue => 'general',
+ Subject => 'type test',
+ Type => 'Ticket',
+ );
+ ok($ok, "Ticket allows passing upper-case Ticket as type during Create");
+ is($t->Type, "ticket", "Ticket type is lowercased during create");
+
+ ($ok) = $t->SetType("REMINDER");
+ ok($ok, "Ticket allows passing upper-case REMINDER to SetType");
+ is($t->Type, "reminder", "Ticket type is lowercased during set");
+
+ ($ok) = $t->SetType("OTHER");
+ ok($ok, "Allows setting Type to non-RT types");
+ is($t->Type, "OTHER", "Non-RT types are case-insensitive");
+
+ ($ok) = $t->Create(
+ Queue => 'general',
+ Subject => 'type test',
+ Type => 'Approval',
+ );
+ ok($ok, "Tickets can be created with an upper-case Approval type");
+ is($t->Type, "approval", "Approvals, the third and final internal type, are also lc'd during Create");
+}
+
+done_testing;
diff --git a/rt/t/api/versions_sorter.t b/rt/t/api/versions_sorter.t
index b2ec547a0..fb628f194 100644
--- a/rt/t/api/versions_sorter.t
+++ b/rt/t/api/versions_sorter.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use RT::Test nodata => 1, tests => 3;
diff --git a/rt/t/articles/article.t b/rt/t/articles/article.t
index 33becb023..7a3474f07 100644
--- a/rt/t/articles/article.t
+++ b/rt/t/articles/article.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/articles/articles.t b/rt/t/articles/articles.t
index c6fe65106..8d2918e50 100644
--- a/rt/t/articles/articles.t
+++ b/rt/t/articles/articles.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/articles/basic-api.t b/rt/t/articles/basic-api.t
index f9f9f89f4..168b8cbea 100644
--- a/rt/t/articles/basic-api.t
+++ b/rt/t/articles/basic-api.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/articles/cfsearch.t b/rt/t/articles/cfsearch.t
index 49420e581..3bfa667ee 100644
--- a/rt/t/articles/cfsearch.t
+++ b/rt/t/articles/cfsearch.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/articles/class.t b/rt/t/articles/class.t
index 84d6e23be..7a7c015fc 100644
--- a/rt/t/articles/class.t
+++ b/rt/t/articles/class.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 24;
+use RT::Test tests => undef;
use_ok 'RT::Articles';
use_ok 'RT::Classes';
@@ -18,14 +17,21 @@ my ($id, $msg) = $cl->Create(Name => 'Test-'.$$, Description => 'A test class');
ok ($id, $msg);
+ok( $cl->SetName( 'test-' . $$ ), 'rename to lower cased version' );
+ok( $cl->SetName( 'Test-' . $$ ), 'rename back' );
+
# no duplicate class names should be allowed
-($id, $msg) = $cl->Create(Name => 'Test-'.$$, Description => 'A test class');
+($id, $msg) = RT::Class->new($root)->Create(Name => 'Test-'.$$, Description => 'A test class');
+
+ok (!$id, $msg);
+
+($id, $msg) = RT::Class->new($root)->Create(Name => 'test-'.$$, Description => 'A test class');
ok (!$id, $msg);
#class name should be required
-($id, $msg) = $cl->Create(Name => '', Description => 'A test class');
+($id, $msg) = RT::Class->new($root)->Create(Name => '', Description => 'A test class');
ok (!$id, $msg);
@@ -74,3 +80,6 @@ $m->submit();
$m->content_like(qr/Description changed from.*no value.*to .*Test Description/,'description changed');
$m->form_number(3);
is($m->current_form->find_input('Include-Name')->value,undef,'Disabled Including Names for this Class');
+
+undef $m;
+done_testing();
diff --git a/rt/t/articles/interface.t b/rt/t/articles/interface.t
index d04be8b88..779127fa6 100644
--- a/rt/t/articles/interface.t
+++ b/rt/t/articles/interface.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -192,10 +191,10 @@ $m->follow_link_ok( { text => 'Extract Article' }, '-> Extract Article' );
$m->content_contains($class->Name);
$m->follow_link_ok( { text => $class->Name }, 'Extract Article -> '. $class->Name );
$m->content_like(qr/Select topics for this article/i, 'selecting topic');
-$m->form_number(3);
+$m->form_number(2);
$m->set_visible([option => $topic1->Name]);
$m->submit;
-$m->form_number(3);
+$m->form_number(2);
$m->set_visible([option => $answerCF->Name]);
$m->click();
$m->title_like(qr/Create a new article/, "got edit page from extraction");
diff --git a/rt/t/articles/queue-specific-class.t b/rt/t/articles/queue-specific-class.t
index a73d583c3..5cd042910 100644
--- a/rt/t/articles/queue-specific-class.t
+++ b/rt/t/articles/queue-specific-class.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -35,7 +34,7 @@ for my $name ( keys %class ) {
'article create page' );
$m->submit_form(
- form_number => 3,
+ form_number => 2,
fields => { Name => "article $name" }
);
diff --git a/rt/t/articles/search-interface.t b/rt/t/articles/search-interface.t
index bcba3116b..e957a6c31 100644
--- a/rt/t/articles/search-interface.t
+++ b/rt/t/articles/search-interface.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -153,7 +152,7 @@ sub DoArticleSearch{
$m->text_contains('First article');
$m->submit_form_ok( {
- form_number => 3,
+ form_number => 2,
fields => {
'Article~' => $search_text
},
diff --git a/rt/t/articles/upload-customfields.t b/rt/t/articles/upload-customfields.t
index 912c23ded..e5ed5d190 100644
--- a/rt/t/articles/upload-customfields.t
+++ b/rt/t/articles/upload-customfields.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/articles/uri-a.t b/rt/t/articles/uri-a.t
index 5c1fdaf36..1a0480f1d 100644
--- a/rt/t/articles/uri-a.t
+++ b/rt/t/articles/uri-a.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/articles/uri-articles.t b/rt/t/articles/uri-articles.t
index 4124b1942..b6a1c8dac 100644
--- a/rt/t/articles/uri-articles.t
+++ b/rt/t/articles/uri-articles.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/customfields/access_via_queue.t b/rt/t/customfields/access_via_queue.t
index 690e177df..a059d69ee 100644
--- a/rt/t/customfields/access_via_queue.t
+++ b/rt/t/customfields/access_via_queue.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 37;
+use RT::Test nodata => 1, tests => 47;
use RT::Ticket;
use RT::CustomField;
@@ -158,3 +157,30 @@ diag "check that owner can see and edit CF";
$m->content_contains($cf_name, "changed cf");
}
+note 'make sure CF is not reset to no value';
+{
+ my $t = RT::Test->create_ticket(
+ Queue => $queue->id,
+ Subject => 'test',
+ 'CustomField-'.$cf->id => '2012-02-12',
+ Cc => $tester->id,
+ Owner => $tester->id,
+ );
+ ok $t && $t->id, 'created ticket';
+ is $t->FirstCustomFieldValue($cf_name), '2012-02-12';
+
+ $m->goto_ticket($t->id);
+ $m->follow_link_ok({id => 'page-basics'});
+ my $form = $m->form_name('TicketModify');
+ my $input = $form->find_input(
+ 'Object-RT::Ticket-'. $t->id .'-CustomField-'. $cf->id .'-Value'
+ );
+ ok $input, 'found input';
+ $m->click('SubmitTicket');
+
+ my $tid = $t->id;
+ $t = RT::Ticket->new( $RT::SystemUser );
+ $t->Load( $tid );
+ is $t->FirstCustomFieldValue($cf_name), '2012-02-12';
+}
+
diff --git a/rt/t/customfields/api.t b/rt/t/customfields/api.t
index d739a572d..2e1c07986 100644
--- a/rt/t/customfields/api.t
+++ b/rt/t/customfields/api.t
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
use strict;
use warnings FATAL => 'all';
-use RT::Test nodata => 1, tests => 139;
+use RT::Test nodata => 1, tests => 145;
+use Test::Warn;
# Before we get going, ditch all object_cfs; this will remove
# all custom fields systemwide;
@@ -69,13 +69,21 @@ is( $cfvs->Count, 0 );
is( $ticket->FirstCustomFieldValue, undef );
# CF with ID -1 shouldnt exist at all
-$cfvs = $ticket->CustomFieldValues( -1 );
+warning_like {
+ $cfvs = $ticket->CustomFieldValues( -1 );
+} qr{Couldn't load custom field};
is( $cfvs->Count, 0 );
-is( $ticket->FirstCustomFieldValue( -1 ), undef );
+warning_like {
+ is( $ticket->FirstCustomFieldValue( -1 ), undef );
+} qr{Couldn't load custom field};
-$cfvs = $ticket->CustomFieldValues( 'SomeUnexpedCustomFieldName' );
+warning_like {
+ $cfvs = $ticket->CustomFieldValues( 'SomeUnexpedCustomFieldName' );
+} qr{Couldn't load custom field};
is( $cfvs->Count, 0 );
-is( $ticket->FirstCustomFieldValue( 'SomeUnexpedCustomFieldName' ), undef );
+warning_like {
+ is( $ticket->FirstCustomFieldValue( 'SomeUnexpedCustomFieldName' ), undef );
+} qr{Couldn't load custom field};
for (@custom_fields) {
$cfvs = $ticket->CustomFieldValues( $_->id );
@@ -183,9 +191,13 @@ $test_add_delete_cycle->( sub { return $_[0] } );
$ticket->AddCustomFieldValue( Field => $local_cf2->id , Value => 'Baz' );
$ticket->AddCustomFieldValue( Field => $global_cf3->id , Value => 'Baz' );
# now if we ask for cf values on RecordCustomFields4 we should not get any
-$cfvs = $ticket->CustomFieldValues( 'RecordCustomFields4' );
+warning_like {
+ $cfvs = $ticket->CustomFieldValues( 'RecordCustomFields4' );
+} qr{Couldn't load custom field};
is( $cfvs->Count, 0, "No custom field values for non-Queue cf" );
-is( $ticket->FirstCustomFieldValue( 'RecordCustomFields4' ), undef, "No first custom field value for non-Queue cf" );
+warning_like {
+ is( $ticket->FirstCustomFieldValue( 'RecordCustomFields4' ), undef, "No first custom field value for non-Queue cf" );
+} qr{Couldn't load custom field};
{
my $cfname = $global_cf3->Name;
diff --git a/rt/t/customfields/combo_cascade.t b/rt/t/customfields/combo_cascade.t
index 28eee4527..fba2fac86 100644
--- a/rt/t/customfields/combo_cascade.t
+++ b/rt/t/customfields/combo_cascade.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/customfields/date_search.t b/rt/t/customfields/date_search.t
index b425b9e36..2a8e6ce7a 100644
--- a/rt/t/customfields/date_search.t
+++ b/rt/t/customfields/date_search.t
@@ -1,17 +1,29 @@
-#!/usr/bin/perl
+use Test::MockTime qw(set_fixed_time restore_time);
use warnings;
use strict;
-use RT::Test nodata => 1, tests => 13;
+use RT::Test nodata => 1, tests => 21;
-my $q = RT::Queue->new(RT->SystemUser);
-ok( $q->Create( Name => 'DateCFTest' . $$ ), 'create queue' );
+RT::Test->set_rights(
+ { Principal => 'Everyone', Right => [qw(
+ SeeQueue ShowTicket CreateTicket SeeCustomField ModifyCustomField
+ )] },
+);
+
+my $q = RT::Test->load_or_create_queue( Name => 'General' );
+ok $q && $q->id, 'loaded or created a queue';
+
+my $user_m = RT::Test->load_or_create_user( Name => 'moscow', Timezone => 'Europe/Moscow' );
+ok $user_m && $user_m->id;
+
+my $user_b = RT::Test->load_or_create_user( Name => 'boston', Timezone => 'America/New_York' );
+ok $user_b && $user_b->id;
my $cf = RT::CustomField->new(RT->SystemUser);
ok(
$cf->Create(
- Name => 'date-' . $$,
+ Name => 'TestDate',
Type => 'Date',
MaxValues => 1,
LookupType => RT::Ticket->CustomFieldLookupType,
@@ -19,6 +31,7 @@ ok(
'create cf date'
);
ok( $cf->AddToObject($q), 'date cf apply to queue' );
+my $cf_name = $cf->Name;
my $ticket = RT::Ticket->new(RT->SystemUser);
@@ -80,6 +93,22 @@ is( $ticket->CustomFieldValues->First->Content, '2010-05-04', 'date in db is' );
}
{
+ my $tickets = RT::Tickets->new(RT->SystemUser);
+ $tickets->FromSQL( "'CF.{$cf_name}' = 'May 4 2010'" );
+ is( $tickets->Count, 1, 'found the ticket with = May 4 2010' );
+
+ $tickets->FromSQL( "'CF.{$cf_name}' < 'May 4 2010'" );
+ is( $tickets->Count, 0, 'did not find the ticket with < May 4 2010' );
+
+ $tickets->FromSQL( "'CF.{$cf_name}' < 'May 5 2010'" );
+ is( $tickets->Count, 1, 'found the ticket with < May 5 2010' );
+
+ $tickets->FromSQL( "'CF.{$cf_name}' > 'May 3 2010'" );
+ is( $tickets->Count, 1, 'found the ticket with > May 3 2010' );
+}
+
+
+{
my $tickets = RT::Tickets->new(RT->SystemUser);
$tickets->LimitCustomField(
@@ -103,17 +132,33 @@ is( $ticket->CustomFieldValues->First->Content, '2010-05-04', 'date in db is' );
is( $tickets->Count, 0, 'did not find the ticket with > 2010-05-05' );
}
-$ticket = RT::Ticket->new(RT->SystemUser);
-
-ok(
- $ticket->Create(
+# relative search by users in different TZs
+{
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ my ($tid) = $ticket->Create(
Queue => $q->id,
Subject => 'Test',
- 'CustomField-' . $cf->id => '2010-05-04 11:34:56',
- ),
- 'create ticket with cf set to 2010-05-04 11:34:56'
-);
+ 'CustomField-' . $cf->id => '2013-02-12',
+ );
-is( $ticket->CustomFieldValues->First->Content,
- '2010-05-04', 'date in db only has date' );
+ set_fixed_time("2013-02-10T23:10:00Z");
+ my $tickets = RT::Tickets->new($user_m);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 1, 'found the ticket' );
+
+ set_fixed_time("2013-02-10T15:10:00Z");
+ $tickets = RT::Tickets->new($user_m);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 0, 'found no tickets' );
+
+ set_fixed_time("2013-02-10T23:10:00Z");
+ $tickets = RT::Tickets->new($user_b);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 0, 'found no tickets' );
+
+ set_fixed_time("2013-02-11T23:10:00Z");
+ $tickets = RT::Tickets->new($user_b);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 1, 'found the tickets' );
+}
diff --git a/rt/t/customfields/datetime_search.t b/rt/t/customfields/datetime_search.t
index 11fe3bc57..6b37cf1bc 100644
--- a/rt/t/customfields/datetime_search.t
+++ b/rt/t/customfields/datetime_search.t
@@ -1,18 +1,30 @@
-#!/usr/bin/perl
+use Test::MockTime qw(set_fixed_time restore_time);
use warnings;
use strict;
-use RT::Test nodata => 1, tests => 14;
+use RT::Test nodata => 1, tests => 30;
RT->Config->Set( 'Timezone' => 'EST5EDT' ); # -04:00
-my $q = RT::Queue->new(RT->SystemUser);
-ok( $q->Create( Name => 'DateTimeCFTest' . $$ ), 'create queue' );
+RT::Test->set_rights(
+ { Principal => 'Everyone', Right => [qw(
+ SeeQueue ShowTicket CreateTicket SeeCustomField ModifyCustomField
+ )] },
+);
+
+my $q = RT::Test->load_or_create_queue( Name => 'General' );
+ok $q && $q->id, 'loaded or created a queue';
+
+my $user_m = RT::Test->load_or_create_user( Name => 'moscow', Timezone => 'Europe/Moscow' );
+ok $user_m && $user_m->id;
+
+my $user_b = RT::Test->load_or_create_user( Name => 'boston', Timezone => 'America/New_York' );
+ok $user_b && $user_b->id;
my $cf = RT::CustomField->new(RT->SystemUser);
ok(
$cf->Create(
- Name => 'datetime-' . $$,
+ Name => 'TestDateTime',
Type => 'DateTime',
MaxValues => 1,
LookupType => RT::Ticket->CustomFieldLookupType,
@@ -20,6 +32,7 @@ ok(
'create cf datetime'
);
ok( $cf->AddToObject($q), 'date cf apply to queue' );
+my $cf_name = $cf->Name;
my $ticket = RT::Ticket->new(RT->SystemUser);
@@ -78,6 +91,23 @@ is(
is( $tickets->Count, 0, 'did not find the ticket with wrong datetime: 2010-05-05' );
}
+{
+ my $tickets = RT::Tickets->new(RT->SystemUser);
+ $tickets->FromSQL( "'CF.{$cf_name}' = 'May 4 2010 7am'" );
+ is( $tickets->Count, 1, 'found the ticket with = May 4 2010 7am' );
+
+ $tickets->FromSQL( "'CF.{$cf_name}' = 'May 4 2010 8am'" );
+ is( $tickets->Count, 0, 'did not find the ticket with = May 4 2010 8am' );
+
+ $tickets->FromSQL( "'CF.{$cf_name}' > 'May 3 2010 7am'" );
+ is( $tickets->Count, 1, 'found the ticket with > May 3 2010 7am' );
+
+ $tickets->FromSQL( "'CF.{$cf_name}' < 'May 4 2010 8am'" );
+ is( $tickets->Count, 1, 'found the ticket with < May 4 2010 8am' );
+
+}
+
+
my $tickets = RT::Tickets->new( RT->SystemUser );
$tickets->UnLimit;
while( my $ticket = $tickets->Next ) {
@@ -139,3 +169,69 @@ while( my $ticket = $tickets->Next ) {
);
is( $tickets->Count, 1, 'found the ticket with = 2010-06-22 01:00:01' );
}
+
+# set timezone in all places to UTC
+{
+ RT->SystemUser->UserObj->__Set(Field => 'Timezone', Value => 'UTC')
+ if RT->SystemUser->UserObj->Timezone;
+ RT->Config->Set( Timezone => 'UTC' );
+}
+
+# search by absolute date with '=', but date only
+{
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ my ($tid) = $ticket->Create(
+ Queue => $q->id,
+ Subject => 'Test',
+ 'CustomField-' . $cf->id => '2013-02-11 23:14:15',
+ );
+ is $ticket->FirstCustomFieldValue($cf_name), '2013-02-11 23:14:15';
+
+ my $tickets = RT::Tickets->new($user_m);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = '2013-02-11' AND id = $tid");
+ is( $tickets->Count, 0);
+
+ $tickets = RT::Tickets->new($user_m);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = '2013-02-12' AND id = $tid");
+ is( $tickets->Count, 1);
+
+ $tickets = RT::Tickets->new($user_b);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = '2013-02-11' AND id = $tid");
+ is( $tickets->Count, 1);
+
+ $tickets = RT::Tickets->new($user_b);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = '2013-02-12' AND id = $tid");
+ is( $tickets->Count, 0);
+}
+
+# search by relative date with '=', but date only
+{
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ my ($tid) = $ticket->Create(
+ Queue => $q->id,
+ Subject => 'Test',
+ 'CustomField-' . $cf->id => '2013-02-11 23:14:15',
+ );
+ is $ticket->FirstCustomFieldValue($cf_name), '2013-02-11 23:14:15';
+
+ set_fixed_time("2013-02-10T16:10:00Z");
+ my $tickets = RT::Tickets->new($user_m);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 0);
+
+ set_fixed_time("2013-02-10T23:10:00Z");
+ $tickets = RT::Tickets->new($user_m);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 1);
+
+ set_fixed_time("2013-02-10T23:10:00Z");
+ $tickets = RT::Tickets->new($user_b);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 1);
+
+ set_fixed_time("2013-02-10T02:10:00Z");
+ $tickets = RT::Tickets->new($user_b);
+ $tickets->FromSQL("'CustomField.{$cf_name}' = 'tomorrow' AND id = $tid");
+ is( $tickets->Count, 0);
+}
+
diff --git a/rt/t/customfields/external.t b/rt/t/customfields/external.t
index 0abf6eca1..73549166a 100644
--- a/rt/t/customfields/external.t
+++ b/rt/t/customfields/external.t
@@ -1,10 +1,9 @@
-#!/usr/bin/perl
use warnings;
use strict;
use RT;
-use RT::Test nodata => 1, tests => 11;
+use RT::Test nodata => 1, tests => 13;
sub new (*) {
my $class = shift;
@@ -54,3 +53,9 @@ isa_ok( $cf, 'RT::CustomField' );
is( $values->Count, $count, "count is correct" );
}
+{
+ my ($ret, $msg) = $cf->SetValuesClass('RT::CustomFieldValues');
+ ok $ret, 'Reverting this CF as internal source values based' or diag "error: $msg";
+ ($ret, $msg) = $cf->SetValuesClass('RT::CustomFieldValues::Groups');
+ ok $ret, 'Reverting this CF as external source values based' or diag "error: $msg";
+}
diff --git a/rt/t/customfields/ip.t b/rt/t/customfields/ip.t
index f73e63fa5..3ab7fbd6a 100644
--- a/rt/t/customfields/ip.t
+++ b/rt/t/customfields/ip.t
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 73;
+use RT::Test tests => undef;
+use Test::Warn;
my ( $baseurl, $agent ) = RT::Test->started_ok;
ok( $agent->login, 'log in' );
@@ -265,7 +265,9 @@ diag "create a ticket with an IP of 10.0.0.1 and search for doesn't match '10.0.
ok( $id, "created first ticket $id" );
my $tickets = RT::Tickets->new($RT::SystemUser);
- $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE '10.0.0.'");
+ warning_like {
+ $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE '10.0.0.'");
+ } [qr/not a valid IPAddress/], "caught warning about valid IP address";
SKIP: {
skip "partical ip parse causes ambiguity", 1;
@@ -283,3 +285,6 @@ diag "test the operators in search page" if $ENV{'TEST_VERBOSE'};
ok( $op, "found 'CF.{IP}'Op" );
is_deeply( [ $op->possible_values ], [ '=', '!=', '<', '>' ], 'op values' );
}
+
+undef $agent;
+done_testing;
diff --git a/rt/t/customfields/iprange.t b/rt/t/customfields/iprange.t
index 118d23c88..af9a52f83 100644
--- a/rt/t/customfields/iprange.t
+++ b/rt/t/customfields/iprange.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/customfields/iprangev6.t b/rt/t/customfields/iprangev6.t
index d823dd6e3..3b8a4d60a 100644
--- a/rt/t/customfields/iprangev6.t
+++ b/rt/t/customfields/iprangev6.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/customfields/ipv6.t b/rt/t/customfields/ipv6.t
index 09c4d30d0..f97420ef6 100644
--- a/rt/t/customfields/ipv6.t
+++ b/rt/t/customfields/ipv6.t
@@ -1,9 +1,9 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 102;
+use RT::Test tests => undef;
+use Test::Warn;
my ( $baseurl, $agent ) = RT::Test->started_ok;
ok( $agent->login, 'log in' );
@@ -242,7 +242,9 @@ diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd
ok( $id, "created first ticket $id" );
my $tickets = RT::Tickets->new($RT::SystemUser);
- $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE 'abcd:23'");
+ warning_like {
+ $tickets->FromSQL("id=$id AND CF.{IP} NOT LIKE 'abcd:23'");
+ } [qr/not a valid IPAddress/], "caught warning about IPAddress";
SKIP: {
skip "partical ip parse can causes ambiguity", 1;
@@ -250,3 +252,5 @@ diag "create a ticket with an IP of abcd:23:: and search for doesn't match 'abcd
}
}
+undef $agent;
+done_testing;
diff --git a/rt/t/customfields/pattern.t b/rt/t/customfields/pattern.t
index 7d1090fa7..2fccb4508 100644
--- a/rt/t/customfields/pattern.t
+++ b/rt/t/customfields/pattern.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/customfields/single_values.t b/rt/t/customfields/single_values.t
index 15a00163c..42ba479b4 100644
--- a/rt/t/customfields/single_values.t
+++ b/rt/t/customfields/single_values.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/customfields/sort_order.t b/rt/t/customfields/sort_order.t
index 2453a7cc8..ba0b654be 100644
--- a/rt/t/customfields/sort_order.t
+++ b/rt/t/customfields/sort_order.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/customfields/transaction.t b/rt/t/customfields/transaction.t
index 22f8459eb..f2e660ee2 100644
--- a/rt/t/customfields/transaction.t
+++ b/rt/t/customfields/transaction.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/fts/indexed_mysql.t b/rt/t/fts/indexed_mysql.t
index 8966f1cd4..c124ff8f8 100644
--- a/rt/t/fts/indexed_mysql.t
+++ b/rt/t/fts/indexed_mysql.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/fts/indexed_oracle.t b/rt/t/fts/indexed_oracle.t
index 5d71712d0..98db30439 100644
--- a/rt/t/fts/indexed_oracle.t
+++ b/rt/t/fts/indexed_oracle.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/fts/indexed_pg.t b/rt/t/fts/indexed_pg.t
index c437c1f4f..b8d4b1bab 100644
--- a/rt/t/fts/indexed_pg.t
+++ b/rt/t/fts/indexed_pg.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/fts/not_indexed.t b/rt/t/fts/not_indexed.t
index 0a1abd081..9ec77ebfb 100644
--- a/rt/t/fts/not_indexed.t
+++ b/rt/t/fts/not_indexed.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/i18n/caching.t b/rt/t/i18n/caching.t
index ebb29423f..f3d1b0139 100644
--- a/rt/t/i18n/caching.t
+++ b/rt/t/i18n/caching.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/i18n/default.t b/rt/t/i18n/default.t
index 6c26b6207..ea0848f54 100644
--- a/rt/t/i18n/default.t
+++ b/rt/t/i18n/default.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/i18n/footer.t b/rt/t/i18n/footer.t
index e0d09058c..5fb8ed4f1 100644
--- a/rt/t/i18n/footer.t
+++ b/rt/t/i18n/footer.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/lifecycles/basics.t b/rt/t/lifecycles/basics.t
index 5825a105d..554c95a73 100644
--- a/rt/t/lifecycles/basics.t
+++ b/rt/t/lifecycles/basics.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/lifecycles/dates.t b/rt/t/lifecycles/dates.t
index d8a27f613..4f613f8d3 100644
--- a/rt/t/lifecycles/dates.t
+++ b/rt/t/lifecycles/dates.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/lifecycles/moving.t b/rt/t/lifecycles/moving.t
index 6e0d64bbf..5f184e2c2 100644
--- a/rt/t/lifecycles/moving.t
+++ b/rt/t/lifecycles/moving.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/lifecycles/unresolved-deps.t b/rt/t/lifecycles/unresolved-deps.t
index aff9a1a56..02c1942d7 100644
--- a/rt/t/lifecycles/unresolved-deps.t
+++ b/rt/t/lifecycles/unresolved-deps.t
@@ -1,10 +1,8 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
use Data::Dumper;
-use Test::More tests => 15;
+use Test::More tests => 15 + 1; # plus one for warnings check
BEGIN {require 't/lifecycles/utils.pl'};
my $general = RT::Test->load_or_create_queue(
diff --git a/rt/t/lifecycles/utils.pl b/rt/t/lifecycles/utils.pl
index 6fb229390..3813df3e9 100644
--- a/rt/t/lifecycles/utils.pl
+++ b/rt/t/lifecycles/utils.pl
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/charsets-outgoing.t b/rt/t/mail/charsets-outgoing.t
index e17dd983d..2fc91f2e0 100644
--- a/rt/t/mail/charsets-outgoing.t
+++ b/rt/t/mail/charsets-outgoing.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use Encode;
diff --git a/rt/t/mail/crypt-gnupg.t b/rt/t/mail/crypt-gnupg.t
index c0a875644..ffb059706 100644
--- a/rt/t/mail/crypt-gnupg.t
+++ b/rt/t/mail/crypt-gnupg.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/dashboards.t b/rt/t/mail/dashboards.t
index 00cfc6acd..edd455300 100644
--- a/rt/t/mail/dashboards.t
+++ b/rt/t/mail/dashboards.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/digest-attributes.t b/rt/t/mail/digest-attributes.t
index 5b4560621..badd59b87 100644
--- a/rt/t/mail/digest-attributes.t
+++ b/rt/t/mail/digest-attributes.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use warnings;
use strict;
diff --git a/rt/t/mail/extractsubjecttag.t b/rt/t/mail/extractsubjecttag.t
index e76da6f82..14fab44b5 100644
--- a/rt/t/mail/extractsubjecttag.t
+++ b/rt/t/mail/extractsubjecttag.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
-use RT::Test tests => 13;
+use RT::Test tests => 18;
my $queue = RT::Test->load_or_create_queue(
Name => 'Regression',
@@ -84,3 +83,24 @@ EOF
}
+diag "Test that extraction of another RT's subject tag grabs only tag";
+{
+ my $ticketid = $original_ticket->Id;
+ my $text = <<EOF;
+From: root\@localhost
+To: general\@$RT::rtname
+Subject: [$subject_tag #$ticketid] [comment] [remote-rt-system #79] test
+
+reply with subject tag and remote rt subject tag
+EOF
+ my ($status, $id) = RT::Test->send_via_mailgate($text, queue => $queue->Name);
+ is ($status >> 8, 0, "The mail gateway exited normally");
+ is ($id, $ticketid, "Replied to ticket $id correctly");
+
+ my $freshticket = RT::Ticket->new( RT->SystemUser );
+ $freshticket->LoadById($id);
+ like($freshticket->Subject,qr/\[remote-rt-system #79\]/,"Kept remote rt's subject tag");
+ unlike($freshticket->Subject,qr/comment/,"doesn't grab comment");
+ unlike($freshticket->Subject,qr/\[\Q$subject_tag\E #$ticketid\]/,'Stripped Queue Subject Tag correctly');
+}
+
diff --git a/rt/t/mail/gateway.t b/rt/t/mail/gateway.t
index 98eabd56e..9482ffcb2 100644
--- a/rt/t/mail/gateway.t
+++ b/rt/t/mail/gateway.t
@@ -1,58 +1,3 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
-=head1 NAME
-
-rt-mailgate - Mail interface to RT3.
-
-=cut
-
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-bad.t b/rt/t/mail/gnupg-bad.t
index c9b28c902..a1c45be05 100644
--- a/rt/t/mail/gnupg-bad.t
+++ b/rt/t/mail/gnupg-bad.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-incoming.t b/rt/t/mail/gnupg-incoming.t
index 6ff4f76ef..48d2d9b73 100644
--- a/rt/t/mail/gnupg-incoming.t
+++ b/rt/t/mail/gnupg-incoming.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -11,7 +10,7 @@ BEGIN {
}
use RT::Test::GnuPG
- tests => 49,
+ tests => 53,
actual_server => 1,
gnupg_options => {
passphrase => 'rt-test',
@@ -234,7 +233,6 @@ RT::Test->close_mailgate_ok($mail);
ok(index($orig->Content, $buf) != -1, 'found original msg');
}
-
# test for signed mail by other key
$buf = '';
@@ -346,3 +344,31 @@ is(@mail, 1, 'caught outgoing mail.');
unlike( ($attach ? $attach->Content : ''), qr/really should not be there either/);
}
+
+# test that if it gets base64 transfer-encoded long mail then it doesn't hang
+{
+ local $SIG{ALRM} = sub {
+ ok 0, "timed out, web server is probably in deadlock";
+ exit;
+ };
+ alarm 30;
+ $buf = encode_base64('a'x(250*1024));
+ $mail = RT::Test->open_mailgate_ok($baseurl);
+ print $mail <<"EOF";
+From: recipient\@example.com
+To: general\@$RT::rtname
+Content-transfer-encoding: base64
+Subject: Long not encrypted message for queue
+
+$buf
+EOF
+ RT::Test->close_mailgate_ok($mail);
+ alarm 0;
+
+ my $tick = RT::Test->last_ticket;
+ is( $tick->Subject, 'Long not encrypted message for queue',
+ "Created the ticket"
+ );
+ my $content = $tick->Transactions->First->Content;
+ like $content, qr/a{1024,}/, 'content is not lost';
+}
diff --git a/rt/t/mail/gnupg-outgoing-encrypted.t b/rt/t/mail/gnupg-outgoing-encrypted.t
index 4f2a28f55..96c748794 100644
--- a/rt/t/mail/gnupg-outgoing-encrypted.t
+++ b/rt/t/mail/gnupg-outgoing-encrypted.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-outgoing-plain.t b/rt/t/mail/gnupg-outgoing-plain.t
index ee9a8ac81..62ae0ed49 100644
--- a/rt/t/mail/gnupg-outgoing-plain.t
+++ b/rt/t/mail/gnupg-outgoing-plain.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-outgoing-signed.t b/rt/t/mail/gnupg-outgoing-signed.t
index 2ea20a2d7..4aa262bee 100644
--- a/rt/t/mail/gnupg-outgoing-signed.t
+++ b/rt/t/mail/gnupg-outgoing-signed.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-outgoing-signed_encrypted.t b/rt/t/mail/gnupg-outgoing-signed_encrypted.t
index 0b82cf1ca..806f62d95 100644
--- a/rt/t/mail/gnupg-outgoing-signed_encrypted.t
+++ b/rt/t/mail/gnupg-outgoing-signed_encrypted.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-realmail.t b/rt/t/mail/gnupg-realmail.t
index 7d1dbcab5..834014ccc 100644
--- a/rt/t/mail/gnupg-realmail.t
+++ b/rt/t/mail/gnupg-realmail.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-reverification.t b/rt/t/mail/gnupg-reverification.t
index 96a37a080..939bf3333 100644
--- a/rt/t/mail/gnupg-reverification.t
+++ b/rt/t/mail/gnupg-reverification.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/gnupg-special.t b/rt/t/mail/gnupg-special.t
index 7dd63478a..15aad3489 100644
--- a/rt/t/mail/gnupg-special.t
+++ b/rt/t/mail/gnupg-special.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/mail/mime_decoding.t b/rt/t/mail/mime_decoding.t
index 7515e2c41..4b3e3c075 100644
--- a/rt/t/mail/mime_decoding.t
+++ b/rt/t/mail/mime_decoding.t
@@ -1,7 +1,6 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test nodb => 1, tests => 9;
+use RT::Test nodb => 1, tests => 13;
use_ok('RT::I18N');
@@ -97,3 +96,45 @@ diag q{canonicalize mime word encodings like gb2312};
);
}
+
+diag q{Whitespace between encoded words should be removed};
+{
+ my $str = "=?utf-8?Q?=E3=82=AD?= =?utf-8?Q?=E3=83=A3?=";
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "キャ",
+ "whitespace between encoded words is removed",
+ );
+
+ $str = "=?utf-8?Q?=E3=82=AD?= \n =?utf-8?Q?=E3=83=A3?=";
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "キャ",
+ "newlines between encoded words also removed",
+ );
+}
+
+diag q{Multiple octets split across QP hunks are correctly reassembled};
+{
+ # This passes even without explicit code to handle it because utf8
+ # is perl's internal string encoding.
+ my $str = "=?utf-8?Q?=E3?= =?utf-8?Q?=82?= =?utf-8?Q?=AD?=";
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "キ",
+ "UTF8 character split in three is successfully reassembled",
+ );
+
+ # Non-utf8 encodings thus also must be checked
+ $str = <<EOT; chomp $str;
+=?gb2312?q?Chinese(gb2312)=20=20=C3=C0=B9=FA=C7=B0=CB=BE=B7=A8=B2=BF=B3?=
+ =?gb2312?q?=A4=C3=E6=BC=FB=C8=F8=B4=EF=C4=B7=BA=F3=B3=C6=C6=E4=D7=B4=CC=AC?=
+ =?gb2312?q?=BA=DC=BA=C3=20=20Chinese=20(gb2312)?=
+EOT
+ is(
+ RT::I18N::DecodeMIMEWordsToUTF8($str),
+ "Chinese(gb2312) 美国前司法部长面见萨达姆后称其状态很好 Chinese (gb2312)",
+ "gb2312 character is successfully reassembled",
+ );
+
+}
diff --git a/rt/t/mail/multipart.t b/rt/t/mail/multipart.t
index a68710a75..1c1106421 100644
--- a/rt/t/mail/multipart.t
+++ b/rt/t/mail/multipart.t
@@ -1,51 +1,3 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
use strict;
use warnings;
diff --git a/rt/t/mail/one-time-recipients.t b/rt/t/mail/one-time-recipients.t
index 985f95562..3484d1470 100644
--- a/rt/t/mail/one-time-recipients.t
+++ b/rt/t/mail/one-time-recipients.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
diff --git a/rt/t/mail/outlook.t b/rt/t/mail/outlook.t
index 00bbc9445..752a91fae 100644
--- a/rt/t/mail/outlook.t
+++ b/rt/t/mail/outlook.t
@@ -1,62 +1,9 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
-=head1 NAME
-
-rt-mailgate - Mail interface to RT3.
-
-=cut
-
use strict;
use warnings;
-use RT::Test tests => 42;
+use RT::Test tests => 66;
+
+RT->Config->Set('CheckMoreMSMailHeaders', 1);
# 12.0 is outlook 2007, 14.0 is 2010
for my $mailer ( 'Microsoft Office Outlook 12.0', 'Microsoft Outlook 14.0' ) {
@@ -199,8 +146,75 @@ EOF
test_email( $text, $content,
$mailer . ' with only text/plain, \n\n are not replaced' );
}
+
+ diag "Test mail with with outlook, content type is base64";
+ {
+ my $text = <<EOF;
+From: root\@localhost
+X-Mailer: $mailer
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: outlook basic test
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: base64
+
+VGhpcyBpcyB0aGUgYm9keSBvZiBhbiBlbWFpbC4KCkl0IGhhcyBtdWx0aXBs
+ZSBleHRyYSBuZXdsaW5lcy4KCgoKTGlrZSBhIG1hbmdsZWQgT3V0bG9vayBt
+ZXNzYWdlIG1pZ2h0LgoKCgpKb2huIFNtaXRoCgpTb21lIENvbXBhbnkKCmVt
+YWlsQHNvbWVjby5jb20KCg==
+EOF
+
+ my $content = <<EOF;
+This is the body of an email.
+It has multiple extra newlines.
+
+Like a mangled Outlook message might.
+
+John Smith
+Some Company
+email\@someco.com
+EOF
+ test_email( $text, $content,
+ $mailer . ' with base64, \n\n are replaced' );
+ }
+}
+
+# In a sample we received, the two X-MS- headers included
+# below were both present and had no values. For now, using
+# the existence of these headers as evidence of MS Outlook
+# or Exchange.
+
+diag "Test mail with with outlook, no X-Mailer, content type is base64";
+{
+ my $text = <<EOF;
+From: root\@localhost
+To: rt\@@{[RT->Config->Get('rtname')]}
+Subject: outlook basic test
+Content-Type: text/plain; charset="utf-8"
+Content-Transfer-Encoding: base64
+X-MS-Has-Attach:
+X-MS-Tnef-Correlator:
+
+VGhpcyBpcyB0aGUgYm9keSBvZiBhbiBlbWFpbC4KCkl0IGhhcyBtdWx0aXBs
+ZSBleHRyYSBuZXdsaW5lcy4KCgoKTGlrZSBhIG1hbmdsZWQgT3V0bG9vayBt
+ZXNzYWdlIG1pZ2h0LgoKCgpKb2huIFNtaXRoCgpTb21lIENvbXBhbnkKCmVt
+YWlsQHNvbWVjby5jb20KCg==
+EOF
+
+ my $content = <<EOF;
+This is the body of an email.
+It has multiple extra newlines.
+
+Like a mangled Outlook message might.
+
+John Smith
+Some Company
+email\@someco.com
+EOF
+ test_email( $text, $content,
+ ' with base64, no X-Mailer, \n\n are replaced' );
}
+
diag "Test mail with with multipart/alternative but x-mailer is not outlook ";
{
my $text = <<EOF;
@@ -234,7 +248,6 @@ Content-Transfer-Encoding: quoted-printable
------=_NextPart_000_0004_01CB045C.A5A075D0--
-
EOF
my $content = <<EOF;
@@ -250,6 +263,129 @@ EOF
test_email( $text, $content, 'without outlook, \n\n are not replaced' );
}
+diag "Sample multipart email with Exchange headers";
+{
+ my $text = <<EOF;
+X-MimeOLE: Produced By Microsoft Exchange V6.5
+Received: by example.com
+ id <01CD63FC.33F4C15C\@example.com>; Tue, 17 Jul 2012 10:11:51 +0100
+MIME-Version: 1.0
+Content-Type: multipart/alternative;
+ boundary="----_=_NextPart_001_01CD63FC.33F4C15C"
+Content-class: urn:content-classes:message
+Subject: outlook basic test
+Date: Tue, 17 Jul 2012 10:11:50 +0100
+Message-ID: <AA6CEAFB02FF244999046B2A6B6B9D6F05FF9D12\@example.com>
+X-MS-Has-Attach:
+X-MS-TNEF-Correlator:
+Thread-Topic: Testing Outlook HTML
+Thread-Index: Ac1j/DNs7ly963bnRt63SJw9DkGwyw==
+From: root\@localhost
+To: rt\@@{[RT->Config->Get('rtname')]}
+
+This is a multi-part message in MIME format.
+
+------_=_NextPart_001_01CD63FC.33F4C15C
+Content-Type: text/plain;
+ charset="us-ascii"
+Content-Transfer-Encoding: quoted-printable
+
+This email contains a line of text containing multiple sentences. Where
+will RT wrap this when the text is quoted? What about the footer below?
+
+=20
+
+This is a different line, with a blank line (paragraph) above. Will
+there be additional blank lines when the text is quoted?
+
+=20
+
+This isthesig
+
+=20
+
+
+------_=_NextPart_001_01CD63FC.33F4C15C
+Content-Type: text/html;
+ charset="us-ascii"
+Content-Transfer-Encoding: quoted-printable
+
+<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
+xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
+xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
+xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
+xmlns=3D"http://www.w3.org/TR/REC-html40"><head><META =
+HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
+charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 12 =
+(filtered medium)"><style><!--
+/* Font Definitions */
+\@font-face
+ {font-family:"Cambria Math";
+ panose-1:2 4 5 3 5 4 6 3 2 4;}
+\@font-face
+ {font-family:Calibri;
+ panose-1:2 15 5 2 2 2 4 3 2 4;}
+/* Style Definitions */
+p.MsoNormal, li.MsoNormal, div.MsoNormal
+ {margin:0in;
+ margin-bottom:.0001pt;
+ font-size:11.0pt;
+ font-family:"Calibri","sans-serif";}
+a:link, span.MsoHyperlink
+ {mso-style-priority:99;
+ color:blue;
+ text-decoration:underline;}
+a:visited, span.MsoHyperlinkFollowed
+ {mso-style-priority:99;
+ color:purple;
+ text-decoration:underline;}
+span.EmailStyle17
+ {mso-style-type:personal-compose;
+ font-family:"Calibri","sans-serif";
+ color:windowtext;}
+.MsoChpDefault
+ {mso-style-type:export-only;}
+\@page WordSection1
+ {size:8.5in 11.0in;
+ margin:1.0in 1.0in 1.0in 1.0in;}
+div.WordSection1
+ {page:WordSection1;}
+--></style><!--[if gte mso 9]><xml>
+<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
+</xml><![endif]--><!--[if gte mso 9]><xml>
+<o:shapelayout v:ext=3D"edit">
+<o:idmap v:ext=3D"edit" data=3D"1" />
+</o:shapelayout></xml><![endif]--></head><body lang=3DEN-US link=3Dblue =
+vlink=3Dpurple><div class=3DWordSection1><p class=3DMsoNormal>This email =
+contains a line of text containing multiple sentences.&nbsp; Where will =
+RT wrap this when the text is quoted?&nbsp; What about the footer =
+below?<o:p></o:p></p><p class=3DMsoNormal><o:p>&nbsp;</o:p></p><p =
+class=3DMsoNormal>This is a different line, with a blank line =
+(paragraph) above.&nbsp; Will there be additional blank lines when the =
+text is quoted?<o:p></o:p></p><p =
+class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal><span =
+lang=3DEN-GB =
+style=3D'font-size:7.5pt;font-family:"Arial","sans-serif"'>This isthesig =
+</span><o:p></o:p></p><p =
+class=3DMsoNormal><o:p>&nbsp;</o:p></p></div></body></html>
+------_=_NextPart_001_01CD63FC.33F4C15C--
+EOF
+
+ my $content = <<EOF;
+This email contains a line of text containing multiple sentences. Where
+will RT wrap this when the text is quoted? What about the footer below?
+
+This is a different line, with a blank line (paragraph) above. Will
+there be additional blank lines when the text is quoted?
+
+This isthesig
+
+EOF
+
+ test_email( $text, $content,
+ 'Another sample multipart message with Exchange headers' );
+}
+
sub test_email {
my ( $text, $content, $msg ) = @_;
my ( $status, $id ) = RT::Test->send_via_mailgate($text);
diff --git a/rt/t/mail/sendmail.t b/rt/t/mail/sendmail.t
index bb5d2db80..44903f375 100644
--- a/rt/t/mail/sendmail.t
+++ b/rt/t/mail/sendmail.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use File::Spec ();
use RT::Test tests => 141;
diff --git a/rt/t/mail/threading.t b/rt/t/mail/threading.t
index 7112ecf07..773b7207f 100644
--- a/rt/t/mail/threading.t
+++ b/rt/t/mail/threading.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
diff --git a/rt/t/mail/verp.t b/rt/t/mail/verp.t
index ed3af6a7b..a07f80079 100644
--- a/rt/t/mail/verp.t
+++ b/rt/t/mail/verp.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use RT::Test nodb => 1, tests => 1;
TODO: {
todo_skip "No tests written for VERP yet", 1;
diff --git a/rt/t/mail/wrong_mime_charset.t b/rt/t/mail/wrong_mime_charset.t
index 511a7e61d..530b5f38d 100644
--- a/rt/t/mail/wrong_mime_charset.t
+++ b/rt/t/mail/wrong_mime_charset.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
use RT::Test nodb => 1, tests => 6;
diff --git a/rt/t/shredder/00load.t b/rt/t/shredder/00load.t
index 21d5ef765..a78e5e4c3 100644
--- a/rt/t/shredder/00load.t
+++ b/rt/t/shredder/00load.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
use File::Spec;
-use Test::More tests => 11;
+use Test::More tests => 11 + 1; # plus one for warnings check
use RT::Test nodb => 1;
BEGIN {
diff --git a/rt/t/shredder/00skeleton.t b/rt/t/shredder/00skeleton.t
index eab9433cd..9c6e3a1c0 100644
--- a/rt/t/shredder/00skeleton.t
+++ b/rt/t/shredder/00skeleton.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 1;
+use Test::More tests => 1 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/01basics.t b/rt/t/shredder/01basics.t
index 99e66c786..1fa9f75ba 100644
--- a/rt/t/shredder/01basics.t
+++ b/rt/t/shredder/01basics.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 3;
+use Test::More tests => 3 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/01ticket.t b/rt/t/shredder/01ticket.t
index a7abeef6e..0a9da413e 100644
--- a/rt/t/shredder/01ticket.t
+++ b/rt/t/shredder/01ticket.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 15;
+use Test::More tests => 15 + 1; # plus one for warnings check
use RT::Test ();
diff --git a/rt/t/shredder/02group_member.t b/rt/t/shredder/02group_member.t
index 9f8a6c6e3..9dc4f6126 100644
--- a/rt/t/shredder/02group_member.t
+++ b/rt/t/shredder/02group_member.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 22;
+use Test::More tests => 22 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/02queue.t b/rt/t/shredder/02queue.t
index fb5e36d6e..dd5581754 100644
--- a/rt/t/shredder/02queue.t
+++ b/rt/t/shredder/02queue.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 16;
+use Test::More tests => 16 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/02template.t b/rt/t/shredder/02template.t
index 16fa61588..aeb318ed6 100644
--- a/rt/t/shredder/02template.t
+++ b/rt/t/shredder/02template.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 7;
+use Test::More tests => 7 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/02user.t b/rt/t/shredder/02user.t
index 8c8657c7d..9f1577015 100644
--- a/rt/t/shredder/02user.t
+++ b/rt/t/shredder/02user.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 8;
+use Test::More tests => 8 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/03plugin.t b/rt/t/shredder/03plugin.t
index cf51e448d..15766cd2e 100644
--- a/rt/t/shredder/03plugin.t
+++ b/rt/t/shredder/03plugin.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 28;
+use Test::More tests => 28 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/03plugin_summary.t b/rt/t/shredder/03plugin_summary.t
index 2744531db..d450c70a2 100644
--- a/rt/t/shredder/03plugin_summary.t
+++ b/rt/t/shredder/03plugin_summary.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 4;
+use Test::More tests => 4 + 1; # plus one for warnings check
use RT::Test nodb => 1;
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/03plugin_tickets.t b/rt/t/shredder/03plugin_tickets.t
index e63eef8fd..1579bc54b 100644
--- a/rt/t/shredder/03plugin_tickets.t
+++ b/rt/t/shredder/03plugin_tickets.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 44;
+use Test::More tests => 44 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/03plugin_users.t b/rt/t/shredder/03plugin_users.t
index 1f4cb4934..131ffa0c3 100644
--- a/rt/t/shredder/03plugin_users.t
+++ b/rt/t/shredder/03plugin_users.t
@@ -1,11 +1,10 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
use Test::Deep;
use File::Spec;
-use Test::More tests => 21;
+use Test::More tests => 21 + 1; # plus one for warnings check
use RT::Test ();
BEGIN {
my $shredder_utils = RT::Test::get_relocatable_file('utils.pl',
diff --git a/rt/t/shredder/utils.pl b/rt/t/shredder/utils.pl
index 9b848c662..7be951370 100644
--- a/rt/t/shredder/utils.pl
+++ b/rt/t/shredder/utils.pl
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/ticket/action_linear_escalate.t b/rt/t/ticket/action_linear_escalate.t
index 2a1be611d..0d1ff8aa5 100644
--- a/rt/t/ticket/action_linear_escalate.t
+++ b/rt/t/ticket/action_linear_escalate.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/ticket/add-watchers.t b/rt/t/ticket/add-watchers.t
index e49c694ed..11b3a8453 100644
--- a/rt/t/ticket/add-watchers.t
+++ b/rt/t/ticket/add-watchers.t
@@ -1,50 +1,3 @@
-#!/usr/bin/perl -w
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
-# <jesse.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
-
use RT::Test nodata => 1, tests => 32;
use strict;
diff --git a/rt/t/ticket/badlinks.t b/rt/t/ticket/badlinks.t
index 71ab73928..6fac5d563 100644
--- a/rt/t/ticket/badlinks.t
+++ b/rt/t/ticket/badlinks.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
use RT::Test tests => 14;
diff --git a/rt/t/ticket/batch-upload-csv.t b/rt/t/ticket/batch-upload-csv.t
index cedc0143a..8dc906e1b 100644
--- a/rt/t/ticket/batch-upload-csv.t
+++ b/rt/t/ticket/batch-upload-csv.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
-use strict; use warnings;
+use strict;
+use warnings;
use RT::Test tests => 12;
use_ok('RT');
diff --git a/rt/t/ticket/cfsort-freeform-multiple.t b/rt/t/ticket/cfsort-freeform-multiple.t
index e285d0e6f..ba6150b4f 100644
--- a/rt/t/ticket/cfsort-freeform-multiple.t
+++ b/rt/t/ticket/cfsort-freeform-multiple.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use RT::Test nodata => 1, tests => 41;
diff --git a/rt/t/ticket/cfsort-freeform-single.t b/rt/t/ticket/cfsort-freeform-single.t
index 35a53fb54..ae109e9e4 100644
--- a/rt/t/ticket/cfsort-freeform-single.t
+++ b/rt/t/ticket/cfsort-freeform-single.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use RT::Test nodata => 1, tests => 89;
diff --git a/rt/t/ticket/clicky.t b/rt/t/ticket/clicky.t
index 3a7ec8241..20d39a3aa 100644
--- a/rt/t/ticket/clicky.t
+++ b/rt/t/ticket/clicky.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/ticket/googleish_search.t b/rt/t/ticket/googleish_search.t
index aa33257f1..d372801bc 100644
--- a/rt/t/ticket/googleish_search.t
+++ b/rt/t/ticket/googleish_search.t
@@ -1,5 +1,4 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/ticket/link_search.t b/rt/t/ticket/link_search.t
index dbcf4b477..9e5ed1c87 100644
--- a/rt/t/ticket/link_search.t
+++ b/rt/t/ticket/link_search.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use RT;
# Load the config file
diff --git a/rt/t/ticket/merge.t b/rt/t/ticket/merge.t
index d06d54174..2484b6512 100644
--- a/rt/t/ticket/merge.t
+++ b/rt/t/ticket/merge.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/ticket/requestor-order.t b/rt/t/ticket/requestor-order.t
index bdacc460e..d8308d391 100644
--- a/rt/t/ticket/requestor-order.t
+++ b/rt/t/ticket/requestor-order.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
-use strict; use warnings;
+use strict;
+use warnings;
use RT::Test tests => 58;
use_ok('RT');
diff --git a/rt/t/ticket/search.t b/rt/t/ticket/search.t
index fd0a7e08f..852241fe5 100644
--- a/rt/t/ticket/search.t
+++ b/rt/t/ticket/search.t
@@ -1,4 +1,3 @@
-#!/opt/perl/bin/perl -w
# tests relating to searching. Especially around custom fields, and
# corner cases.
@@ -6,7 +5,7 @@
use strict;
use warnings;
-use RT::Test nodata => 1, tests => 43;
+use RT::Test nodata => 1, tests => undef;
# setup the queue
@@ -276,3 +275,12 @@ $tix = RT::Tickets->new(RT->SystemUser);
$tix->FromSQL("CF.SearchTest = 'foo1' OR CF.SearchTest = 'foo3' OR CF.SearchTest2 = 'bar1' OR CF.SearchTest2 = 'bar2'");
is($tix->Count, 3, "is cf1 or is cf1 or is cf2 or is cf2");
+# tests with lower cased NULL
+$tix = RT::Tickets->new(RT->SystemUser);
+$tix->FromSQL('Requestor.Name IS null');
+is($tix->Count, 1, "t6 doesn't have a Requestor");
+like($tix->BuildSelectCountQuery, qr/\bNULL\b/, "Contains upper-case NULL");
+unlike($tix->BuildSelectCountQuery, qr/\bnull\b/, "Lacks lower-case NULL");
+
+
+done_testing;
diff --git a/rt/t/ticket/search_by_cf_freeform_multiple.t b/rt/t/ticket/search_by_cf_freeform_multiple.t
index 4e7cddc06..1b4f0922c 100644
--- a/rt/t/ticket/search_by_cf_freeform_multiple.t
+++ b/rt/t/ticket/search_by_cf_freeform_multiple.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/ticket/search_by_cf_freeform_single.t b/rt/t/ticket/search_by_cf_freeform_single.t
index 278a3ce03..f8462a9af 100644
--- a/rt/t/ticket/search_by_cf_freeform_single.t
+++ b/rt/t/ticket/search_by_cf_freeform_single.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/ticket/search_by_links.t b/rt/t/ticket/search_by_links.t
index 61b69b73e..d25d3002e 100644
--- a/rt/t/ticket/search_by_links.t
+++ b/rt/t/ticket/search_by_links.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/ticket/search_by_txn.t b/rt/t/ticket/search_by_txn.t
index 0e5f76dcd..6f970aadc 100644
--- a/rt/t/ticket/search_by_txn.t
+++ b/rt/t/ticket/search_by_txn.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use warnings;
use strict;
diff --git a/rt/t/ticket/search_by_watcher.t b/rt/t/ticket/search_by_watcher.t
index cfc7b1c22..a6800bbb4 100644
--- a/rt/t/ticket/search_by_watcher.t
+++ b/rt/t/ticket/search_by_watcher.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/ticket/search_long_cf_values.t b/rt/t/ticket/search_long_cf_values.t
index 6ce8505d6..5b904b363 100644
--- a/rt/t/ticket/search_long_cf_values.t
+++ b/rt/t/ticket/search_long_cf_values.t
@@ -1,4 +1,3 @@
-#!/opt/perl/bin/perl -w
# tests relating to searching. Especially around custom fields with long values
# (> 255 chars)
diff --git a/rt/t/ticket/sort-by-custom-ownership.t b/rt/t/ticket/sort-by-custom-ownership.t
index b06e9a00a..80e88a818 100644
--- a/rt/t/ticket/sort-by-custom-ownership.t
+++ b/rt/t/ticket/sort-by-custom-ownership.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use RT;
use RT::Test nodata => 1, tests => 7;
diff --git a/rt/t/ticket/sort-by-queue.t b/rt/t/ticket/sort-by-queue.t
index bf2934bc2..f54ccf7a6 100644
--- a/rt/t/ticket/sort-by-queue.t
+++ b/rt/t/ticket/sort-by-queue.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use RT::Test nodata => 1, tests => 12;
diff --git a/rt/t/ticket/sort-by-user.t b/rt/t/ticket/sort-by-user.t
index 10d43de37..42f95fc25 100644
--- a/rt/t/ticket/sort-by-user.t
+++ b/rt/t/ticket/sort-by-user.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use RT::Test nodata => 1, tests => 52;
diff --git a/rt/t/ticket/sort_by_cf.t b/rt/t/ticket/sort_by_cf.t
index 65704da62..30f6ad815 100644
--- a/rt/t/ticket/sort_by_cf.t
+++ b/rt/t/ticket/sort_by_cf.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use RT::Test nodata => 1, tests => 21;
RT::Init();
diff --git a/rt/t/validator/group_members.t b/rt/t/validator/group_members.t
index 781801426..fbe758017 100644
--- a/rt/t/validator/group_members.t
+++ b/rt/t/validator/group_members.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/admin_groups.t b/rt/t/web/admin_groups.t
index 783b5ad44..075fb6282 100644
--- a/rt/t/web/admin_groups.t
+++ b/rt/t/web/admin_groups.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/admin_user.t b/rt/t/web/admin_user.t
index fde075f4d..36b9af1b4 100644
--- a/rt/t/web/admin_user.t
+++ b/rt/t/web/admin_user.t
@@ -1,9 +1,19 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 7;
+use RT::Test::GnuPG
+ tests => undef,
+ gnupg_options => {
+ passphrase => 'recipient',
+ 'trust-model' => 'always',
+ };
+
+RT::Test->import_gnupg_key( 'rt-test@example.com', 'secret' );
+
+ok( my $user = RT::User->new( RT->SystemUser ) );
+ok( $user->Load('root'), "loaded user 'root'" );
+$user->SetEmailAddress('rt-test@example.com');
my ( $url, $m ) = RT::Test->started_ok;
ok( $m->login(), 'logged in' );
@@ -17,5 +27,54 @@ diag "test the history page" if $ENV{TEST_VERBOSE};
$m->get_ok( $url . '/Admin/Users/History.html?id=' . $root->id );
$m->content_contains('User created', 'has User created entry');
+diag "test gnupg page" if $ENV{TEST_VERBOSE};
+$m->follow_link_ok( { text => 'GnuPG' } );
+$m->content_contains('GnuPG public key');
+$m->content_contains('The key is ultimately trusted');
+$m->content_contains('F0CB3B482CFA485680A4A0BDD328035D84881F1B');
+$m->content_contains('Tue Aug 07 2007');
+$m->content_contains('never');
+
+$m->content_contains('GnuPG private key');
+
+my $form = $m->form_with_fields('PrivateKey');
+is( $form->find_input('PrivateKey')->value,
+ '__empty_value__', 'default no private key' );
+$m->submit_form_ok(
+ {
+ fields => { PrivateKey => 'D328035D84881F1B' },
+ button => 'Update',
+ },
+ 'submit PrivateKey form'
+);
+
+$m->content_contains('Set private key');
+$form = $m->form_with_fields('PrivateKey');
+is( $form->find_input('PrivateKey')->value,
+ 'D328035D84881F1B', 'set private key' );
+$m->submit_form_ok(
+ {
+ fields => { PrivateKey => '__empty_value__' },
+ button => 'Update',
+ },
+ 'submit PrivateKey form'
+);
+
+$m->content_contains('Unset private key');
+is( $form->find_input('PrivateKey')->value,
+ '__empty_value__', 'unset private key' );
+$form = $m->form_with_fields('PrivateKey');
+$m->submit_form_ok(
+ {
+ fields => { PrivateKey => 'C798591AA831DBFB' },
+ button => 'Update',
+ },
+ 'submit PrivateKey form'
+);
+is( $form->find_input('PrivateKey')->value,
+ 'C798591AA831DBFB', 'set private key' );
+
# TODO more /Admin/Users tests
+undef $m;
+done_testing;
diff --git a/rt/t/web/attachment_encoding.t b/rt/t/web/attachment_encoding.t
index bfbf24590..5af7fda20 100644
--- a/rt/t/web/attachment_encoding.t
+++ b/rt/t/web/attachment_encoding.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/attachments.t b/rt/t/web/attachments.t
index 784cbbe88..b518ec176 100644
--- a/rt/t/web/attachments.t
+++ b/rt/t/web/attachments.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 33;
diff --git a/rt/t/web/basic.t b/rt/t/web/basic.t
index 31e28c406..e61e80e9c 100644
--- a/rt/t/web/basic.t
+++ b/rt/t/web/basic.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/case-sensitivity.t b/rt/t/web/case-sensitivity.t
index f984bf3e4..f9c61b519 100644
--- a/rt/t/web/case-sensitivity.t
+++ b/rt/t/web/case-sensitivity.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/cf_access.t b/rt/t/web/cf_access.t
index 73b7765c1..675fa2177 100644
--- a/rt/t/web/cf_access.t
+++ b/rt/t/web/cf_access.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 32;
diff --git a/rt/t/web/cf_date.t b/rt/t/web/cf_date.t
index 887aa4220..4ea93e4de 100644
--- a/rt/t/web/cf_date.t
+++ b/rt/t/web/cf_date.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/cf_datetime.t b/rt/t/web/cf_datetime.t
index 9781c5e2e..8cc099d1c 100644
--- a/rt/t/web/cf_datetime.t
+++ b/rt/t/web/cf_datetime.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/cf_onqueue.t b/rt/t/web/cf_onqueue.t
index 422eeff60..bd6ae66aa 100644
--- a/rt/t/web/cf_onqueue.t
+++ b/rt/t/web/cf_onqueue.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 14;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/cf_select_one.t b/rt/t/web/cf_select_one.t
index 15fe416b4..92fcf53f3 100644
--- a/rt/t/web/cf_select_one.t
+++ b/rt/t/web/cf_select_one.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/class_create.t b/rt/t/web/class_create.t
index cec41a8aa..2d9ad035d 100644
--- a/rt/t/web/class_create.t
+++ b/rt/t/web/class_create.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/clickjacking-preventions.t b/rt/t/web/clickjacking-preventions.t
index dde82952b..e3f7f446a 100644
--- a/rt/t/web/clickjacking-preventions.t
+++ b/rt/t/web/clickjacking-preventions.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/command_line.t b/rt/t/web/command_line.t
index 394daaba9..7c444f49d 100644
--- a/rt/t/web/command_line.t
+++ b/rt/t/web/command_line.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use File::Spec ();
use Test::Expect;
-use RT::Test tests => 315, actual_server => 1;
+use RT::Test tests => undef, actual_server => 1;
my ($baseurl, $m) = RT::Test->started_ok;
use RT::User;
@@ -83,6 +82,16 @@ TODO: {
expect_like(qr/$queue_id: EditedQueue$$/, 'Found the queue');
}
+# Queues with spaces in their names
+expect_send("create -t queue set Name='Spaced Out'", 'Creating a queue...');
+expect_like(qr/Queue \d+ created/, 'Created the queue');
+expect_handle->before() =~ /Queue (\d+) created/;
+my $other_queue = $1;
+ok($other_queue, "Got queue id=$other_queue");
+expect_send("show 'queue/Spaced Out'", 'Showing the queue...');
+expect_like(qr/id: queue\/$other_queue/, 'Saw the queue');
+expect_like(qr/Name: Spaced Out/, 'Saw the modification');
+
# Set up a custom field for editing tests
@@ -536,4 +545,7 @@ sub check_attachment {
my @warnings = grep { $_ !~ /\$ampm/ } $m->get_warnings;
is( scalar @warnings, 0, 'no extra warnings' );
+undef $m;
+done_testing;
+
1; # needed to avoid a weird exit value from expect_quit
diff --git a/rt/t/web/command_line_with_unknown_field.t b/rt/t/web/command_line_with_unknown_field.t
index d63956be3..6afad8a85 100644
--- a/rt/t/web/command_line_with_unknown_field.t
+++ b/rt/t/web/command_line_with_unknown_field.t
@@ -1,9 +1,8 @@
-#!/usr/bin/perl -w
-
use strict;
+use warnings;
use File::Spec ();
use Test::Expect;
-use RT::Test tests => 17, actual_server => 1;
+use RT::Test tests => 21, actual_server => 1;
my ($baseurl, $m) = RT::Test->started_ok;
my $rt_tool_path = "$RT::BinPath/rt";
@@ -38,6 +37,15 @@ expect_send("edit ticket/$ticket_id set homer=simpson", 'set unknown field');
expect_like(qr/homer: Unknown field/, 'homer is unknown field');
expect_like(qr/homer: simpson/, 'the value we set for homer is shown too');
+expect_send(
+ q{create -t ticket set requestors='foo@example.com, bar@example.com'},
+ "create ticket with field 'requestors'" );
+expect_like(qr/Ticket \d+ created/, "Created the ticket");
+expect_handle->before() =~ /Ticket (\d+) created/;
+$ticket_id = $1;
+expect_send("show ticket/$ticket_id", 'check requestors');
+expect_like(qr/From: (?:foo\@example\.com, bar\@example\.com|bar\@example\.com, foo\@example\.com)/, "requestors are set correctly");
+
expect_quit();
# you may encounter warning like Use of uninitialized value $ampm
diff --git a/rt/t/web/compilation_errors.t b/rt/t/web/compilation_errors.t
index 1f82ab91f..0ae6ead5b 100644
--- a/rt/t/web/compilation_errors.t
+++ b/rt/t/web/compilation_errors.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use Test::More;
use File::Find;
BEGIN {
@@ -9,7 +8,7 @@ BEGIN {
}
my $tests = 8;
find( sub { wanted() and $tests += 4 }, 'share/html/' );
- plan tests => $tests;
+ plan tests => $tests + 1; # plus one for warnings check
}
diff --git a/rt/t/web/config_tab_right.t b/rt/t/web/config_tab_right.t
index 361506c10..69bf80c69 100644
--- a/rt/t/web/config_tab_right.t
+++ b/rt/t/web/config_tab_right.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/crypt-gnupg.t b/rt/t/web/crypt-gnupg.t
index b30edc3d8..1743a3a8e 100644
--- a/rt/t/web/crypt-gnupg.t
+++ b/rt/t/web/crypt-gnupg.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test::GnuPG
tests => 102,
diff --git a/rt/t/web/csrf-rest.t b/rt/t/web/csrf-rest.t
index 5bb908165..d909c4a8d 100644
--- a/rt/t/web/csrf-rest.t
+++ b/rt/t/web/csrf-rest.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/csrf.t b/rt/t/web/csrf.t
index d99b4ce22..24aae40a1 100644
--- a/rt/t/web/csrf.t
+++ b/rt/t/web/csrf.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/custom_frontpage.t b/rt/t/web/custom_frontpage.t
index 43c5f6e33..ee5e9f58a 100644
--- a/rt/t/web/custom_frontpage.t
+++ b/rt/t/web/custom_frontpage.t
@@ -1,7 +1,7 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
-use RT::Test tests => 12;
+use RT::Test tests => 19;
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
@@ -88,3 +88,22 @@ $m->click_button( name => 'add' );
$m->get($url);
$m->content_like( qr/special chars \[test\] \d+ \[_1\]/,
'special chars in titlebox' );
+
+
+# Edit a system saved search to contain "[more]"
+{
+ my $search = RT::Attribute->new( RT->SystemUser );
+ $search->LoadByNameAndObject( Name => 'Search - My Tickets', Object => RT->System );
+ my ($id, $desc) = ($search->id, RT->SystemUser->loc($search->Description, '&#34;N&#34;'));
+ ok $id, 'loaded search attribute';
+
+ $m->get_ok($url);
+ $m->follow_link_ok({ url_regex => qr"Prefs/Search\.html\?name=.+?Attribute-$id" }, 'Edit link');
+ $m->content_contains($desc, "found description: $desc");
+
+ ok +($search->SetDescription( $search->Description . " [more]" ));
+
+ $m->get_ok($m->uri); # "reload_ok"
+ $m->content_contains($desc . " [more]", "found description: $desc");
+}
+
diff --git a/rt/t/web/custom_search.t b/rt/t/web/custom_search.t
index f8fde2500..bf7d659cd 100644
--- a/rt/t/web/custom_search.t
+++ b/rt/t/web/custom_search.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 13;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/dashboards-basics.t b/rt/t/web/dashboards-basics.t
index 1d56da5be..edb706810 100644
--- a/rt/t/web/dashboards-basics.t
+++ b/rt/t/web/dashboards-basics.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 122;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/dashboards-deleted-saved-search.t b/rt/t/web/dashboards-deleted-saved-search.t
index 4cd7fea1f..cb96acaf0 100644
--- a/rt/t/web/dashboards-deleted-saved-search.t
+++ b/rt/t/web/dashboards-deleted-saved-search.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/dashboards-groups.t b/rt/t/web/dashboards-groups.t
index ac2a5aca0..db2fccf1c 100644
--- a/rt/t/web/dashboards-groups.t
+++ b/rt/t/web/dashboards-groups.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test nodata => 1, tests => 64;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/dashboards-permissions.t b/rt/t/web/dashboards-permissions.t
index f2e59e5cc..433fdd373 100644
--- a/rt/t/web/dashboards-permissions.t
+++ b/rt/t/web/dashboards-permissions.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/dashboards-search-cache.t b/rt/t/web/dashboards-search-cache.t
index ad2a96969..517e26ee6 100644
--- a/rt/t/web/dashboards-search-cache.t
+++ b/rt/t/web/dashboards-search-cache.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 20;
my ($baseurl, $m) = RT::Test->started_ok;
diff --git a/rt/t/web/gnupg-headers.t b/rt/t/web/gnupg-headers.t
index 88b3ab9c2..03e60901e 100644
--- a/rt/t/web/gnupg-headers.t
+++ b/rt/t/web/gnupg-headers.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test::GnuPG
tests => 15,
diff --git a/rt/t/web/gnupg-select-keys-on-create.t b/rt/t/web/gnupg-select-keys-on-create.t
index cf27e48a7..893ae65c9 100644
--- a/rt/t/web/gnupg-select-keys-on-create.t
+++ b/rt/t/web/gnupg-select-keys-on-create.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/gnupg-select-keys-on-update.t b/rt/t/web/gnupg-select-keys-on-update.t
index 4842dcd54..1509d1df3 100644
--- a/rt/t/web/gnupg-select-keys-on-update.t
+++ b/rt/t/web/gnupg-select-keys-on-update.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/gnupg-tickyboxes.t b/rt/t/web/gnupg-tickyboxes.t
index 944539758..eb4388a2c 100644
--- a/rt/t/web/gnupg-tickyboxes.t
+++ b/rt/t/web/gnupg-tickyboxes.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/googleish_search.t b/rt/t/web/googleish_search.t
index f4c8fa4b6..a5f834eee 100644
--- a/rt/t/web/googleish_search.t
+++ b/rt/t/web/googleish_search.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/group_create.t b/rt/t/web/group_create.t
index 26da59268..548970d2d 100644
--- a/rt/t/web/group_create.t
+++ b/rt/t/web/group_create.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/html_template.t b/rt/t/web/html_template.t
index 662a26bbd..78b95a3b2 100644
--- a/rt/t/web/html_template.t
+++ b/rt/t/web/html_template.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -32,7 +31,7 @@ Content-Type: text/html
EOF
},
);
- $m->content_like( qr/Content changed/, 'content is changed' );
+ $m->content_like( qr/Content updated/, 'content is changed' );
$m->content_contains( '你好', 'content is really updated' );
}
diff --git a/rt/t/web/installer.t b/rt/t/web/installer.t
index 4dc82df47..a34cdcb4b 100644
--- a/rt/t/web/installer.t
+++ b/rt/t/web/installer.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
@@ -52,7 +51,14 @@ diag "Walking through install screens setting defaults";
# Database details
$m->content_contains('DatabaseName');
- $m->submit();
+ if (RT->Config->Get('DatabaseType') eq 'SQLite') {
+ $m->submit;
+ } else {
+ $m->submit_form(with_fields => {
+ DatabaseAdmin => $ENV{RT_DBA_USER},
+ DatabaseAdminPassword => $ENV{RT_DBA_PASSWORD},
+ });
+ }
$m->content_contains('Connection succeeded');
$m->submit_form_ok({ button => 'Next' });
@@ -91,5 +97,6 @@ diag "Walking through install screens setting defaults";
ok $m->login(), 'logged in';
}
+RT::Test::__drop_database();
undef $m;
done_testing;
diff --git a/rt/t/web/logout.t b/rt/t/web/logout.t
index 889e5fc18..73ff25c33 100644
--- a/rt/t/web/logout.t
+++ b/rt/t/web/logout.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/offline.t b/rt/t/web/offline.t
index b3762fc20..06d51913a 100644
--- a/rt/t/web/offline.t
+++ b/rt/t/web/offline.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/offline_messages_utf8.t b/rt/t/web/offline_messages_utf8.t
index bf9cf39fa..4518c7b7a 100644
--- a/rt/t/web/offline_messages_utf8.t
+++ b/rt/t/web/offline_messages_utf8.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/offline_utf8.t b/rt/t/web/offline_utf8.t
index 24795c0d3..c317a4616 100644
--- a/rt/t/web/offline_utf8.t
+++ b/rt/t/web/offline_utf8.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/owner_disabled_group_19221.t b/rt/t/web/owner_disabled_group_19221.t
index 2664c5bc2..d41decfd2 100644
--- a/rt/t/web/owner_disabled_group_19221.t
+++ b/rt/t/web/owner_disabled_group_19221.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/passthrough-jsmin b/rt/t/web/passthrough-jsmin
index 3d9bf0129..41b0196b4 100644
--- a/rt/t/web/passthrough-jsmin
+++ b/rt/t/web/passthrough-jsmin
@@ -1,4 +1,3 @@
-#!/bin/sh
echo "// passthrough-jsmin added this";
diff --git a/rt/t/web/private-components.t b/rt/t/web/private-components.t
index ceb2b34af..3ece854a7 100644
--- a/rt/t/web/private-components.t
+++ b/rt/t/web/private-components.t
@@ -1,4 +1,5 @@
use strict;
+use warnings;
use RT::Test tests => 24;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/query_builder.t b/rt/t/web/query_builder.t
index 5a64d4646..13cd1b5d0 100644
--- a/rt/t/web/query_builder.t
+++ b/rt/t/web/query_builder.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
diff --git a/rt/t/web/query_builder_queue_limits.t b/rt/t/web/query_builder_queue_limits.t
index f583d64cc..332cc939c 100644
--- a/rt/t/web/query_builder_queue_limits.t
+++ b/rt/t/web/query_builder_queue_limits.t
@@ -78,8 +78,8 @@ ok( !$form->find_input("ValueOf'CF.{foo_cf}'"), 'no foo_cf by default' );
my $status_input = $form->find_input('ValueOfStatus');
my @statuses = sort $status_input->possible_values;
is_deeply(
- \@statuses, [ '', qw/initial new open rejected resolved stalled/], 'found all statuses'
-);
+ \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/], 'found all statuses'
+) or diag "Statuses are: ", explain \@statuses;
my $owner_input = $form->find_input('ValueOfActor');
my @owners = sort $owner_input->possible_values;
@@ -126,9 +126,9 @@ $status_input = $form->find_input('ValueOfStatus');
@statuses = sort $status_input->possible_values;
is_deeply(
\@statuses,
- [ '', qw/initial new open rejected resolved stalled/ ],
+ [ '', qw/initial new open open rejected resolved resolved stalled/ ],
'found all statuses again'
-);
+) or diag "Statuses are: ", explain \@statuses;
$owner_input = $form->find_input('ValueOfActor');
@owners = sort $owner_input->possible_values;
is_deeply(
@@ -150,9 +150,9 @@ ok( !$form->find_input("ValueOf'CF.{general_cf}'"), 'no general_cf' );
$status_input = $form->find_input('ValueOfStatus');
@statuses = sort $status_input->possible_values;
is_deeply(
- \@statuses, [ '', qw/initial new open rejected resolved stalled/],
+ \@statuses, [ '', qw/initial new open open rejected resolved resolved stalled/],
'found all statuses'
-);
+) or diag "Statuses are: ", explain \@statuses;
$owner_input = $form->find_input('ValueOfActor');
@owners = sort $owner_input->possible_values;
is_deeply(
@@ -173,9 +173,9 @@ $status_input = $form->find_input('ValueOfStatus');
@statuses = sort $status_input->possible_values;
is_deeply(
\@statuses,
- [ '', qw/initial new open rejected resolved stalled/ ],
+ [ '', qw/initial new open open rejected resolved resolved stalled/ ],
'found all statuses'
-);
+) or diag "Statuses are: ", explain \@statuses;
$owner_input = $form->find_input('ValueOfActor');
@owners = sort $owner_input->possible_values;
is_deeply(
diff --git a/rt/t/web/query_log.t b/rt/t/web/query_log.t
index e19f44dc6..89cca2d7b 100644
--- a/rt/t/web/query_log.t
+++ b/rt/t/web/query_log.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/queue_caching.t b/rt/t/web/queue_caching.t
index d90aacbdf..d4857115e 100644
--- a/rt/t/web/queue_caching.t
+++ b/rt/t/web/queue_caching.t
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use RT::Test tests => 36;
+use RT::Test tests => 48;
# make an initial queue, so we have more than 1
my $original_test_queue = new_queue("Test$$");
@@ -31,6 +31,12 @@ diag("Bring back a disabled queue");
check_queues($m);
}
+diag("Rename the original queue, make sure the name change is uncached");
+{
+ ok($original_test_queue->SetName("Name Change $$"));
+ check_queues($m);
+}
+
diag("Test a user who has more limited rights Queues");
{
@@ -47,7 +53,7 @@ my $a_m = RT::Test::Web->new;
ok $a_m->login('user_a', 'password'), 'logged in as user A';
# check that they see a single queue
-check_queues($a_m,[$original_test_queue->Id]);
+check_queues($a_m,[$original_test_queue->Id],[$original_test_queue->Name]);
ok( RT::Test->add_rights(
{ Principal => $user_a, Right => [qw(SeeQueue CreateTicket)] },
@@ -75,16 +81,22 @@ sub internal_queues {
}
-# takes a WWW::Mech object and an optional arrayref of queue ids
-# compares the list of ids to the dropdown of Queues for the New Ticket In form
+# takes a WWW::Mech object and two optional arrayrefs of queue ids and names
+# compares the list of ids and names to the dropdown of Queues for the New Ticket In form
sub check_queues {
- my $browser = shift;
- my $queue_list = shift;
+ my ($browser, $queue_id_list, $queue_name_list) = @_;
$browser->get_ok($baseurl,"Navigated to homepage");
ok(my $form = $browser->form_name('CreateTicketInQueue'), "Found New Ticket In form");
ok(my $queuelist = $form->find_input('Queue','option'), "Found queue select");
- my @queues = $queuelist->possible_values;
- $queue_list = [keys %{internal_queues()}] unless $queue_list;
- is_deeply([sort @queues],[sort @$queue_list], "Queue list contains the expected queues");
+ my @queue_ids = $queuelist->possible_values;
+ my @queue_names = $queuelist->value_names;
+
+ my $full_queue_list = internal_queues();
+ $queue_id_list = [keys %$full_queue_list] unless $queue_id_list;
+ $queue_name_list = [values %$full_queue_list] unless $queue_name_list;
+ is_deeply([sort @queue_ids],[sort @$queue_id_list],
+ "Queue list contains the expected queue ids");
+ is_deeply([sort @queue_names],[sort @$queue_name_list],
+ "Queue list contains the expected queue namess");
}
diff --git a/rt/t/web/queue_create.t b/rt/t/web/queue_create.t
index 3d2cd04d0..566876231 100644
--- a/rt/t/web/queue_create.t
+++ b/rt/t/web/queue_create.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/quickcreate.t b/rt/t/web/quickcreate.t
index b257f9ddd..c49ad8c85 100644
--- a/rt/t/web/quickcreate.t
+++ b/rt/t/web/quickcreate.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/quicksearch.t b/rt/t/web/quicksearch.t
index 8cc084ce5..922dc318f 100644
--- a/rt/t/web/quicksearch.t
+++ b/rt/t/web/quicksearch.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/redirect-after-login.t b/rt/t/web/redirect-after-login.t
index 835b24c37..35025a1e1 100644
--- a/rt/t/web/redirect-after-login.t
+++ b/rt/t/web/redirect-after-login.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/redirect.t b/rt/t/web/redirect.t
index d92386bb8..d909d8d43 100644
--- a/rt/t/web/redirect.t
+++ b/rt/t/web/redirect.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/reminders.t b/rt/t/web/reminders.t
index 32e130c47..af7e2fb26 100644
--- a/rt/t/web/reminders.t
+++ b/rt/t/web/reminders.t
@@ -1,7 +1,6 @@
-#!/usr/bin/env perl
use strict;
use warnings;
-use RT::Test tests => 35;
+use RT::Test tests => 45;
my ($baseurl, $m) = RT::Test->started_ok;
@@ -27,6 +26,23 @@ $m->goto_ticket($ticket->id);
$m->form_name('UpdateReminders');
$m->field( 'NewReminder-Subject' => "baby's first reminder" );
$m->submit;
+$m->content_contains("Reminder &#39;baby&#39;s first reminder&#39; added");
+
+$ticket->SetStatus('deleted');
+is( $ticket->Status, 'deleted', 'deleted ticket' );
+$m->form_name('UpdateReminders');
+$m->field( 'NewReminder-Subject' => "link to a deleted ticket" );
+$m->submit;
+$m->content_contains("Can&#39;t link to a deleted ticket");
+$m->get_ok('/Tools/MyReminders.html');
+$m->content_contains( "baby&#39;s first reminder",
+ 'got the reminder even the ticket is deleted' );
+
+$m->goto_ticket( $ticket->id );
+$m->content_lacks('New reminder:', "can't create a new reminder");
+$m->text_contains('Check box to complete', "we DO display this text when there are reminders");
+$m->content_like(qr{<th[^>]*>Reminders?</th>}, "now we have a reminder titlebar");
+$m->text_contains("baby's first reminder", "display the reminder's subject");
my $reminders = RT::Reminders->new($user);
$reminders->Ticket($ticket->id);
@@ -37,7 +53,11 @@ is($reminder->Subject, "baby's first reminder");
my $reminder_id = $reminder->id;
is($reminder->Status, 'new');
-$m->text_contains('New reminder:', 'can create a new reminder');
+$ticket->SetStatus('new');
+is( $ticket->Status, 'new', 'changed back to new' );
+
+$m->goto_ticket($ticket->id);
+$m->text_contains('New reminder:', "can create a new reminder");
$m->text_contains('Check box to complete', "we DO display this text when there are reminders");
$m->content_like(qr{<th[^>]*>Reminders?</th>}, "now we have a reminder titlebar");
$m->text_contains("baby's first reminder", "display the reminder's subject");
diff --git a/rt/t/web/requestor_groups_edit_link.t b/rt/t/web/requestor_groups_edit_link.t
index 9d1fefd5c..cf67311eb 100644
--- a/rt/t/web/requestor_groups_edit_link.t
+++ b/rt/t/web/requestor_groups_edit_link.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/requestor_groups_limit.t b/rt/t/web/requestor_groups_limit.t
index 7987a136c..abc21cad7 100644
--- a/rt/t/web/requestor_groups_limit.t
+++ b/rt/t/web/requestor_groups_limit.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/rest-non-ascii-subject.t b/rt/t/web/rest-non-ascii-subject.t
index d7a89af5e..8b870a8b1 100644
--- a/rt/t/web/rest-non-ascii-subject.t
+++ b/rt/t/web/rest-non-ascii-subject.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
# Test ticket creation with REST using non ascii subject
use strict;
use warnings;
diff --git a/rt/t/web/rest-sort.t b/rt/t/web/rest-sort.t
index 6b4d35169..5ddaa8ec5 100644
--- a/rt/t/web/rest-sort.t
+++ b/rt/t/web/rest-sort.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
use RT::Test tests => 25;
diff --git a/rt/t/web/rest.t b/rt/t/web/rest.t
index e38f201fb..3a84b2a01 100644
--- a/rt/t/web/rest.t
+++ b/rt/t/web/rest.t
@@ -1,21 +1,28 @@
-#!/usr/bin/env perl
use strict;
use warnings;
use RT::Interface::REST;
-use RT::Test tests => 22;
+use RT::Test tests => 34;
my ($baseurl, $m) = RT::Test->started_ok;
for my $name ("severity", "fu()n:k/") {
my $cf = RT::Test->load_or_create_custom_field(
Name => $name,
- Type => 'Freeform',
+ Type => 'FreeformMultiple',
Queue => 'General',
);
ok($cf->Id, "created a CustomField");
is($cf->Name, $name, "correct CF name");
}
+{
+ my $cf = RT::Test->load_or_create_custom_field(
+ Name => 'single',
+ Type => 'FreeformSingle',
+ Queue => 'General',
+ );
+ ok($cf->Id, "created a CustomField");
+}
my $queue = RT::Test->load_or_create_queue(Name => 'General');
ok($queue->Id, "loaded the General queue");
@@ -150,3 +157,171 @@ $m->post(
);
($link) = $m->content =~ m|DependedOnBy:.*ticket/(\d+)|;
is($link, 1, "Check ticket link.") or diag("'content' obtained:\n", $m->content);
+
+
+{
+ $m->post("$baseurl/REST/1.0/ticket/new", [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ ]);
+
+ my $text = $m->content;
+ my @lines = $text =~ m{.*}g;
+ shift @lines; # header
+ push @lines, "CF.{severity}: explosive";
+ push @lines, "CF.{severity}: very";
+ $text = join "\n", @lines;
+
+ $m->post("$baseurl/REST/1.0/ticket/edit", [
+ user => 'root',
+ pass => 'password',
+
+ content => $text,
+ ], Content_Type => 'form-data');
+
+ my ($id) = $m->content =~ /Ticket (\d+) created/;
+ ok($id, "got ticket #$id");
+
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ $ticket->Load($id);
+ is($ticket->Id, $id, "loaded the REST-created ticket");
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("severity")->ItemsArrayRef }],
+ ["explosive", "very"],
+ "CF successfully set"
+ );
+
+ $m->post(
+ "$baseurl/REST/1.0/ticket/show",
+ [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ id => "ticket/$id",
+ ]
+ );
+ $text = $m->content;
+ $text =~ s/.*?\n\n//;
+ $text =~ s/\n\n/\n/;
+ $text =~ s{CF\.{severity}:.*\n}{}img;
+ $text .= "CF.{severity}: explosive, a bit\n";
+ $m->post(
+ "$baseurl/REST/1.0/ticket/edit",
+ [
+ user => 'root',
+ pass => 'password',
+ content => $text,
+ ],
+ Content_Type => 'form-data'
+ );
+ $m->content =~ /Ticket ($id) updated/;
+
+ $ticket->Load($id);
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("severity")->ItemsArrayRef }],
+ ['a bit', 'explosive'],
+ "CF successfully set"
+ );
+
+ $m->post(
+ "$baseurl/REST/1.0/ticket/show",
+ [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ id => "ticket/$id",
+ ]
+ );
+ $text = $m->content;
+ $text =~ s{CF\.{severity}:.*\n}{}img;
+ $text .= "CF.{severity}:\n";
+ $m->post(
+ "$baseurl/REST/1.0/ticket/edit",
+ [
+ user => 'root',
+ pass => 'password',
+ content => $text,
+ ],
+ Content_Type => 'form-data'
+ );
+ $m->content =~ /Ticket ($id) updated/;
+
+ $ticket->Load($id);
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("severity")->ItemsArrayRef }],
+ [],
+ "CF successfully set"
+ );
+
+ my @txns = map [$_->OldValue, $_->NewValue], grep $_->Type eq 'CustomField',
+ @{ $ticket->Transactions->ItemsArrayRef };
+ is_deeply(\@txns, [['very', undef], [undef, 'a bit'], ['explosive', undef], ['a bit', undef]]);
+}
+
+{
+ $m->post("$baseurl/REST/1.0/ticket/new", [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ ]);
+
+ my $text = $m->content;
+ my @lines = $text =~ m{.*}g;
+ shift @lines; # header
+ push @lines, "CF.{single}: this";
+ $text = join "\n", @lines;
+
+ $m->post("$baseurl/REST/1.0/ticket/edit", [
+ user => 'root',
+ pass => 'password',
+
+ content => $text,
+ ], Content_Type => 'form-data');
+
+ my ($id) = $m->content =~ /Ticket (\d+) created/;
+ ok($id, "got ticket #$id");
+
+ my $ticket = RT::Ticket->new(RT->SystemUser);
+ $ticket->Load($id);
+ is($ticket->Id, $id, "loaded the REST-created ticket");
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("single")->ItemsArrayRef }],
+ ["this"],
+ "CF successfully set"
+ );
+
+ $m->post(
+ "$baseurl/REST/1.0/ticket/show",
+ [
+ user => 'root',
+ pass => 'password',
+ format => 'l',
+ id => "ticket/$id",
+ ]
+ );
+ $text = $m->content;
+ $text =~ s{CF\.{single}:.*\n}{}img;
+ $text .= "CF.{single}: that\n";
+ $m->post(
+ "$baseurl/REST/1.0/ticket/edit",
+ [
+ user => 'root',
+ pass => 'password',
+ content => $text,
+ ],
+ Content_Type => 'form-data'
+ );
+ $m->content =~ /Ticket ($id) updated/;
+
+ $ticket->Load($id);
+ is_deeply(
+ [sort map $_->Content, @{ $ticket->CustomFieldValues("single")->ItemsArrayRef }],
+ ['that'],
+ "CF successfully set"
+ );
+
+ my @txns = map [$_->OldValue, $_->NewValue], grep $_->Type eq 'CustomField',
+ @{ $ticket->Transactions->ItemsArrayRef };
+ is_deeply(\@txns, [['this', 'that']]);
+}
diff --git a/rt/t/web/richtext-autohandler.t b/rt/t/web/richtext-autohandler.t
index 734426fc3..724a7b34c 100644
--- a/rt/t/web/richtext-autohandler.t
+++ b/rt/t/web/richtext-autohandler.t
@@ -1,4 +1,5 @@
use strict;
+use warnings;
use RT::Test tests => 9;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/rights.t b/rt/t/web/rights.t
index 9a5f358e2..23b357f79 100644
--- a/rt/t/web/rights.t
+++ b/rt/t/web/rights.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl -w
use strict;
use warnings;
diff --git a/rt/t/web/rights1.t b/rt/t/web/rights1.t
index 24e5c3448..63ddb38c4 100644
--- a/rt/t/web/rights1.t
+++ b/rt/t/web/rights1.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use HTTP::Cookies;
use RT::Test nodata => 1, tests => 31;
diff --git a/rt/t/web/saved_search_chart.t b/rt/t/web/saved_search_chart.t
index f84307162..70111b97c 100644
--- a/rt/t/web/saved_search_chart.t
+++ b/rt/t/web/saved_search_chart.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/saved_search_context.t b/rt/t/web/saved_search_context.t
index fe9c51ead..0c37a6a3a 100644
--- a/rt/t/web/saved_search_context.t
+++ b/rt/t/web/saved_search_context.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/saved_search_permissions.t b/rt/t/web/saved_search_permissions.t
index 5cae30b28..f61c931a0 100644
--- a/rt/t/web/saved_search_permissions.t
+++ b/rt/t/web/saved_search_permissions.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/saved_search_update.t b/rt/t/web/saved_search_update.t
index dfb18d49c..f06f70fb6 100644
--- a/rt/t/web/saved_search_update.t
+++ b/rt/t/web/saved_search_update.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/scrips.t b/rt/t/web/scrips.t
index def20eca7..0ff46bf26 100644
--- a/rt/t/web/scrips.t
+++ b/rt/t/web/scrips.t
@@ -1,5 +1,3 @@
-#!/usr/bin/perl
-
use strict;
use warnings;
diff --git a/rt/t/web/scrub.t b/rt/t/web/scrub.t
index 612c6e210..835f41226 100644
--- a/rt/t/web/scrub.t
+++ b/rt/t/web/scrub.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/search_bulk_update_links.t b/rt/t/web/search_bulk_update_links.t
index 7d150a699..ffe2efe81 100644
--- a/rt/t/web/search_bulk_update_links.t
+++ b/rt/t/web/search_bulk_update_links.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/search_rss.t b/rt/t/web/search_rss.t
index 95de931c3..9a53a8d94 100644
--- a/rt/t/web/search_rss.t
+++ b/rt/t/web/search_rss.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use RT::Test tests => 38;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/search_tabs.t b/rt/t/web/search_tabs.t
index b3ed2cbdf..b679eafca 100644
--- a/rt/t/web/search_tabs.t
+++ b/rt/t/web/search_tabs.t
@@ -1,6 +1,6 @@
-#!/usr/bin/perl
-use warnings;
use strict;
+use warnings;
+
use RT::Test tests => 21;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/template.t b/rt/t/web/template.t
index 40a5366dc..4a2e6c13a 100644
--- a/rt/t/web/template.t
+++ b/rt/t/web/template.t
@@ -1,8 +1,7 @@
-#!/usr/bin/perl
use strict;
use warnings;
-use RT::Test tests => 19;
+use RT::Test tests => 22;
my $user_a = RT::Test->load_or_create_user(
Name => 'user_a', Password => 'password',
@@ -60,3 +59,35 @@ $m->title_is(q{Modify template Resolved}, 'modifying the Resolved template');
$m->form_name('ModifyTemplate');
is($m->value('Type'), 'Perl', 'now that we have ExecuteCode we can update Type to Perl');
+{ # 21152: Each time you save a Template a newline is chopped off the front
+ $m->form_name('ModifyTemplate');
+ my $content;
+
+
+ TODO: {
+
+ local $TODO = "WWW::Mechanize doesn't strip newline following <textarea> tag like browsers do";
+ # this test fails because earlier tests add newlines when using Mech
+ like($content = $m->value('Content'), qr/^Subject: Resolved/, 'got expected Content');
+
+ }
+
+ $content = "\n\n\n" . $content;
+ $m->field(Content => $content);
+ $m->submit;
+
+ $m->content_contains('Template Resolved: Content updated');
+
+ # next submit should not result in an update
+ $m->form_name('ModifyTemplate');
+ $m->submit;
+
+ TODO: {
+
+ local $TODO = "WWW::Mechanize doesn't strip newline following <textarea> tag like browsers do";
+ # this test fails because the template change makes Mech continuously add newlines where browsers dont
+ $m->content_lacks('Template Resolved: Content updated');
+
+ }
+}
+
diff --git a/rt/t/web/ticket-create-utf8.t b/rt/t/web/ticket-create-utf8.t
index 8d36bd19e..bebc57b51 100644
--- a/rt/t/web/ticket-create-utf8.t
+++ b/rt/t/web/ticket-create-utf8.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_display.t b/rt/t/web/ticket_display.t
index a9cab0cbf..35e921732 100644
--- a/rt/t/web/ticket_display.t
+++ b/rt/t/web/ticket_display.t
@@ -1,7 +1,7 @@
use strict;
use warnings;
-use RT::Test tests => 18;
+use RT::Test tests => undef;
my $queue = RT::Test->load_or_create_queue( Name => 'General' );
@@ -10,10 +10,15 @@ my $user = RT::Test->load_or_create_user(
Password => 'password',
);
+my $cf = RT::Test->load_or_create_custom_field( Name => 'test_cf', Queue => $queue->Name, Type => 'FreeformSingle' );
+my $cf_form_id = 'Object-RT::Ticket--CustomField-'.$cf->Id.'-Value';
+my $cf_test_value = "some string for test_cf $$";
+
my ( $baseurl, $m ) = RT::Test->started_ok;
ok(
RT::Test->set_rights(
{ Principal => $user, Right => [qw(SeeQueue CreateTicket)] },
+ { Principal => $user, Object => $queue, Right => [qw(SeeCustomField ModifyCustomField)] }
),
'set rights'
);
@@ -26,7 +31,7 @@ diag "test ShowTicket right";
$m->get_ok( '/Ticket/Create.html?Queue=' . $queue->id,
'go to ticket create page' );
my $form = $m->form_name('TicketCreate');
- $m->submit_form( fields => { Subject => 'ticket foo' } );
+ $m->submit_form( fields => { Subject => 'ticket foo', $cf_form_id => $cf_test_value } );
my $ticket = RT::Test->last_ticket;
ok( $ticket->id, 'ticket is created' );
@@ -56,8 +61,9 @@ diag "test ShowTicket right";
$m->content_lacks( "No permission to view ticket", 'no error msg' );
$m->title_is( "#$id: ticket foo", 'we can it' );
+ $m->content_contains($cf_test_value, "Custom Field was submitted and saved");
}
-# TODO more /Ticket/Display.html tests here
-
+undef $m;
+done_testing();
diff --git a/rt/t/web/ticket_forward.t b/rt/t/web/ticket_forward.t
index 0c411b99f..adf4d6f69 100644
--- a/rt/t/web/ticket_forward.t
+++ b/rt/t/web/ticket_forward.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_modify_all.t b/rt/t/web/ticket_modify_all.t
index 2f0c4d1b3..6d19b28e4 100644
--- a/rt/t/web/ticket_modify_all.t
+++ b/rt/t/web/ticket_modify_all.t
@@ -68,7 +68,7 @@ $m->field(WatcherTypeEmail => 'Requestor');
$m->field(WatcherAddressEmail => 'root@localhost');
$m->click('SubmitTicket');
$m->text_contains(
- "Added principal as a Requestor for this ticket",
+ "Added root as a Requestor for this ticket",
'watcher is added',
);
$m->form_name('TicketModifyAll');
@@ -76,7 +76,7 @@ $m->field(WatcherTypeEmail => 'Requestor');
$m->field(WatcherAddressEmail => 'root@localhost');
$m->click('SubmitTicket');
$m->text_contains(
- "That principal is already a Requestor for this ticket",
+ "root is already a Requestor for this ticket",
'no duplicate watchers',
);
diff --git a/rt/t/web/ticket_owner.t b/rt/t/web/ticket_owner.t
index 4db39e61a..81508534a 100644
--- a/rt/t/web/ticket_owner.t
+++ b/rt/t/web/ticket_owner.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_owner_autocomplete.t b/rt/t/web/ticket_owner_autocomplete.t
index 3aa3f282f..040aa7323 100644
--- a/rt/t/web/ticket_owner_autocomplete.t
+++ b/rt/t/web/ticket_owner_autocomplete.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_owner_issues_16656.t b/rt/t/web/ticket_owner_issues_16656.t
index a6306f740..c9fc7830e 100644
--- a/rt/t/web/ticket_owner_issues_16656.t
+++ b/rt/t/web/ticket_owner_issues_16656.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_seen.t b/rt/t/web/ticket_seen.t
index 8dacaf59f..e40782f6a 100644
--- a/rt/t/web/ticket_seen.t
+++ b/rt/t/web/ticket_seen.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;
diff --git a/rt/t/web/ticket_txn_content.t b/rt/t/web/ticket_txn_content.t
index db4751218..c0cae976c 100644
--- a/rt/t/web/ticket_txn_content.t
+++ b/rt/t/web/ticket_txn_content.t
@@ -1,5 +1,5 @@
-#!/usr/bin/perl -w
use strict;
+use warnings;
use RT::Test tests => 63;
my $plain_file = File::Spec->catfile( RT::Test->temp_directory, 'attachment.txt' );
diff --git a/rt/t/web/ticket_update_without_content.t b/rt/t/web/ticket_update_without_content.t
index 54f0c5a8a..b4247abe3 100644
--- a/rt/t/web/ticket_update_without_content.t
+++ b/rt/t/web/ticket_update_without_content.t
@@ -1,4 +1,3 @@
-#!/usr/bin/env perl
use strict;
use warnings;
diff --git a/rt/t/web/unlimited_search.t b/rt/t/web/unlimited_search.t
index 988a2918d..6a5f69724 100644
--- a/rt/t/web/unlimited_search.t
+++ b/rt/t/web/unlimited_search.t
@@ -1,6 +1,5 @@
-#!/usr/bin/perl
-
use strict;
+use warnings;
use RT::Test tests => 85;
my ($baseurl, $agent) = RT::Test->started_ok;
diff --git a/rt/t/web/user_update.t b/rt/t/web/user_update.t
index dc908fc10..f55c773cd 100644
--- a/rt/t/web/user_update.t
+++ b/rt/t/web/user_update.t
@@ -1,32 +1,43 @@
-#!/usr/bin/perl
use strict;
use warnings;
use utf8;
-use RT::Test tests => 9;
+use RT::Test tests => undef;
my ( $url, $m ) = RT::Test->started_ok;
ok( $m->login(), 'logged in' );
$m->follow_link_ok({text => 'About me'});
-$m->form_with_fields('Lang');
-$m->field(Lang => 'ja');
-$m->submit;
-
+$m->submit_form_ok({ with_fields => { Lang => 'ja'} },
+ "Change to Japanese");
$m->text_contains("Lang changed from (no value) to 'ja'");
+$m->text_contains("実名", "Page content is japanese");
# we only changed one field, and it wasn't the default, so this feedback is
# spurious and annoying
$m->content_lacks("That is already the current value");
# change back to English
-$m->form_with_fields('Lang');
-$m->field(Lang => 'en_us');
-$m->submit;
+$m->submit_form_ok({ with_fields => { Lang => 'en_us'} },
+ "Change back to english");
# This message shows up in Japanese
# $m->text_contains("Lang changed from 'ja' to 'en_us'");
$m->text_contains("Langは「'ja'」から「'en_us'」に変更されました");
+$m->text_contains("Real Name", "Page content is english");
-# another spurious update
+# Check for a lack of spurious updates
$m->content_lacks("That is already the current value");
+# Ensure that we can change the language back to the default.
+$m->submit_form_ok({ with_fields => { Lang => 'ja'} },
+ "Back briefly to Japanese");
+$m->text_contains("Lang changed from 'en_us' to 'ja'");
+$m->text_contains("実名", "Page content is japanese");
+$m->submit_form_ok({ with_fields => { Lang => ''} },
+ "And set to the default");
+$m->text_contains("Langは「'ja'」から「''」に変更されました");
+$m->text_contains("Real Name", "Page content is english");
+
+undef $m;
+
+done_testing;
diff --git a/rt/t/web/walk.t b/rt/t/web/walk.t
index 34fab1476..97aa36e12 100644
--- a/rt/t/web/walk.t
+++ b/rt/t/web/walk.t
@@ -1,4 +1,3 @@
-#!/usr/bin/perl
use strict;
use warnings;