summaryrefslogtreecommitdiff
path: root/rt/t/api
diff options
context:
space:
mode:
Diffstat (limited to 'rt/t/api')
-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
15 files changed, 61 insertions, 66 deletions
diff --git a/rt/t/api/attachment_filename.t b/rt/t/api/attachment_filename.t
index bcbfe00..6bfc707 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 f55214a..e8a75c1 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 6f9d7f6..6bd992d 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 6fcaa49..728a4a2 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 3ce3da9..2c1ca73 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 139ec1a..956cb15 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 5f253d5..e5155e3 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 a1795ca..107fb2b 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 62f62c4..c8107fe 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 ef6092b..8b7b54b 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 b29e971..43b5c91 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 22d3f21..6fba7e5 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 5961536..4b0fc5f 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 92c8a85..da287a6 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 b2ec547..fb628f1 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;