[Rt-commit] r8289 - rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT
ruz at bestpractical.com
ruz at bestpractical.com
Wed Jul 25 16:03:13 EDT 2007
Author: ruz
Date: Wed Jul 25 16:03:12 2007
New Revision: 8289
Modified:
rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
Log:
* add load_or_create_queue in RT::Test
Modified: rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm (original)
+++ rt/branches/3.7-EXPERIMENTAL-TUNIS/lib/RT/Test.pm Wed Jul 25 16:03:12 2007
@@ -158,7 +158,7 @@
=head1 UTILITIES
-=head2 create_user
+=head2 load_or_create_user
=cut
@@ -187,6 +187,27 @@
return $obj;
}
+=head2 load_or_create_queue
+
+=cut
+
+sub load_or_create_queue {
+ my $self = shift;
+ my %args = ( Disabled => 0, @_ );
+ my $obj = RT::Queue->new( $RT::SystemUser );
+ if ( $args{'Name'} ) {
+ $obj->LoadByCols( Name => $args{'Name'} );
+ } else {
+ die "Name is required";
+ }
+ unless ( $obj->id ) {
+ my ($val, $msg) = $obj->Create( %args );
+ die "$msg" unless $val;
+ }
+
+ return $obj;
+}
+
sub set_rights {
my $self = shift;
my @list = ref $_[0]? @_: { @_ };
More information about the Rt-commit
mailing list