[Rt-commit] r15403 - in rt/branches/3.999-DANGEROUS: . t/api t/mail t/maildigest t/web
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Fri Aug 22 23:39:16 EDT 2008
Author: sunnavy
Date: Fri Aug 22 23:39:15 2008
New Revision: 15403
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/t/api/reminders.t
rt/branches/3.999-DANGEROUS/t/mail/charsets-outgoing.t
rt/branches/3.999-DANGEROUS/t/maildigest/attributes.t
rt/branches/3.999-DANGEROUS/t/ticket/action_linear_escalate.t
rt/branches/3.999-DANGEROUS/t/ticket/add-watchers.t
rt/branches/3.999-DANGEROUS/t/ticket/badlinks.t
rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-multiple.t
rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-single.t
rt/branches/3.999-DANGEROUS/t/ticket/search_long_cf_values.t
rt/branches/3.999-DANGEROUS/t/ticket/sort-by-queue.t
rt/branches/3.999-DANGEROUS/t/ticket/sort-by-user.t
rt/branches/3.999-DANGEROUS/t/web/cf_onqueue.t
rt/branches/3.999-DANGEROUS/t/web/dashboards-groups.t
rt/branches/3.999-DANGEROUS/t/web/dashboards.t
rt/branches/3.999-DANGEROUS/t/web/rest.t
rt/branches/3.999-DANGEROUS/t/web/unlimited_search.t
Log:
r16018 at sunnavys-mb: sunnavy | 2008-08-23 11:36:17 +0800
a bunch of name fixes for new added tests
Modified: rt/branches/3.999-DANGEROUS/t/api/reminders.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/reminders.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/reminders.t Fri Aug 22 23:39:15 2008
@@ -1,10 +1,10 @@
use strict;
use warnings;
+use RT::Test;
use Test::More;
plan tests => 20;
use RT;
-use RT::Test;
{
@@ -14,59 +14,60 @@
ok(my $testqueue = RT::Model::Queue->new(current_user => RT->system_user), 'Instantiate RT::Model::Queue');
ok($testqueue->create( name => 'reminders tests'), 'Create new queue: reminders tests');
-isnt($testqueue->Id , 0, 'Success creating queue');
+isnt($testqueue->id , 0, 'Success creating queue');
ok($testqueue->create( name => 'reminders tests 2'), 'Create new queue: reminders tests 2');
-isnt($testqueue->Id , 0, 'Success creating queue');
+isnt($testqueue->id , 0, 'Success creating queue');
# Create test ticket
use_ok('RT::Model::Ticket');
my $u = RT::Model::User->new(current_user => RT->system_user);
-$u->Load("root");
-ok ($u->Id, "Found the root user");
+$u->load("root");
+ok ($u->id, "Found the root user");
ok(my $t = RT::Model::Ticket->new(current_user => RT->system_user), 'Instantiate RT::Model::Ticket');
-ok(my ($id, $msg) = $t->create( Queue => $testqueue->Id,
- Subject => 'Testing',
- Owner => $u->Id
+ok(my ($id, $msg) = $t->create( queue => $testqueue->id,
+ subject => 'Testing',
+ owner => $u->id
), 'Create sample ticket');
isnt($id , 0, 'Success creating ticket');
# Add reminder
my $due_obj = RT::Date->new( $RT::SystemUser );
-$due_obj->SetToNow;
-ok(my ( $add_id, $add_msg, $txnid ) = $t->Reminders->Add(
- Subject => 'TestReminder',
- Owner => 'root',
- Due => $due_obj->ISO
+$due_obj->set_to_now;
+ok(my ( $add_id, $add_msg, $txnid ) = $t->reminders->add(
+ subject => 'TestReminder',
+ owner => 'root',
+ due => $due_obj->iso
), 'Add reminder');
# Check that the new Reminder is here
-my $reminders = $t->Reminders->Collection;
+my $reminders = $t->reminders->collection;
ok($reminders, 'Loading reminders for this ticket');
my $found = 0;
while ( my $reminder = $reminders->next ) {
+ warn $reminder->id,"\n";
next unless $found == 0;
- $found = 1 if ( $reminder->Subject =~ m/TestReminder/ );
+ $found = 1 if ( $reminder->subject =~ m/TestReminder/ );
}
is($found, 1, 'Reminder successfully added');
# Change queue
-ok (my ($move_val, $move_msg) = $t->SetQueue('reminders tests 2'), 'Moving ticket from queue "reminders tests" to "reminders tests 2"');
+ok (my ($move_val, $move_msg) = $t->set_queue('reminders tests 2'), 'Moving ticket from queue "reminders tests" to "reminders tests 2"');
-is ($t->QueueObj->Name, 'reminders tests 2', 'Ticket successfully moved');
+is ($t->queue_obj->name, 'reminders tests 2', 'Ticket successfully moved');
# Check that the new reminder is still there and moved to the new queue
-$reminders = $t->Reminders->Collection;
+$reminders = $t->reminders->collection;
ok($reminders, 'Loading reminders for this ticket');
$found = 0;
my $ok_queue = 0;
while ( my $reminder = $reminders->next ) {
next unless $found == 0;
- if ( $reminder->Subject =~ m/TestReminder/ ) {
+ if ( $reminder->subject =~ m/TestReminder/ ) {
$found = 1;
- $ok_queue = 1 if ( $reminder->QueueObj->Name eq 'reminders tests 2' );
+ $ok_queue = 1 if ( $reminder->queue_obj->name eq 'reminders tests 2' );
}
}
is($found, 1, 'Reminder successfully added');
@@ -76,10 +77,10 @@
# Resolve reminder
my $r_resolved = 0;
while ( my $reminder = $reminders->next ) {
- if ( $reminder->Subject =~ m/TestReminder/ ) {
- if ( $reminder->Status ne 'resolved' ) {
- $t->Reminders->Resolve($reminder);
- $r_resolved = 1 if ( $reminder->Status eq 'resolved' );
+ if ( $reminder->subject =~ m/TestReminder/ ) {
+ if ( $reminder->status ne 'resolved' ) {
+ $t->reminders->resolve($reminder);
+ $r_resolved = 1 if ( $reminder->status eq 'resolved' );
}
}
}
Modified: rt/branches/3.999-DANGEROUS/t/mail/charsets-outgoing.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/charsets-outgoing.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/charsets-outgoing.t Fri Aug 22 23:39:15 2008
@@ -1,36 +1,36 @@
#!/usr/bin/perl
use strict;
use warnings;
+use RT::Test;
use utf8;
use Test::More;
-use RT::Test;
plan tests => 30;
RT::Test->set_mail_catcher;
my $queue = RT::Test->load_or_create_queue(
- Name => 'Regression',
- CorrespondAddress => 'rt-recipient at example.com',
- CommentAddress => 'rt-recipient at example.com',
+ name => 'Regression',
+ correspond_address => 'rt-recipient at example.com',
+ comment_address => 'rt-recipient at example.com',
);
ok $queue && $queue->id, 'loaded or created queue';
diag "make sure queue has no subject tag" if $ENV{'TEST_VERBOSE'};
{
- my ($status, $msg) = $queue->SetSubjectTag( undef );
+ my ($status, $msg) = $queue->set_subject_tag( undef );
ok $status, "set subject tag for the queue" or diag "error: $msg";
}
diag "set intial simple autoreply template" if $ENV{'TEST_VERBOSE'};
{
- my $template = RT::Template->new( $RT::SystemUser );
- $template->Load('Autoreply');
+ my $template = RT::Model::Template->new( current_user => RT->system_user );
+ $template->load('Autoreply');
ok $template->id, "loaded autoreply tempalte";
- my ($status, $msg) = $template->SetContent(
- "Subject: Autreply { \$Ticket->Subject }\n"
+ my ($status, $msg) = $template->set_content(
+ "Subject: Autreply { \$ticket->subject }\n"
."\n"
."hi there it's an autoreply.\n"
."\n"
@@ -41,11 +41,11 @@
diag "basic test of autoreply" if $ENV{'TEST_VERBOSE'};
{
- my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
+ my $ticket = RT::Model::Ticket->new( current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => 'test',
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => 'test',
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -60,9 +60,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => $str_ru_test,
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => $str_ru_test,
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -79,7 +79,7 @@
diag "set non-ascii subject tag for the queue" if $ENV{'TEST_VERBOSE'};
{
- my ($status, $msg) = $queue->SetSubjectTag( $str_ru_support );
+ my ($status, $msg) = $queue->set_subject_tag( $str_ru_support );
ok $status, "set subject tag for the queue" or diag "error: $msg";
}
@@ -87,9 +87,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => 'test',
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => 'test',
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -108,9 +108,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => $str_ru_test,
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => $str_ru_test,
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -129,18 +129,18 @@
diag "return back the empty subject tag" if $ENV{'TEST_VERBOSE'};
{
- my ($status, $msg) = $queue->SetSubjectTag( undef );
+ my ($status, $msg) = $queue->set_subject_tag( undef );
ok $status, "set subject tag for the queue" or diag "error: $msg";
}
diag "add non-ascii subject prefix in the autoreply template" if $ENV{'TEST_VERBOSE'};
{
- my $template = RT::Template->new( $RT::SystemUser );
- $template->Load('Autoreply');
+ my $template = RT::Model::Template->new( current_user => RT->system_user );
+ $template->load('Autoreply');
ok $template->id, "loaded autoreply tempalte";
- my ($status, $msg) = $template->SetContent(
- "Subject: $str_ru_autoreply { \$Ticket->Subject }\n"
+ my ($status, $msg) = $template->set_content(
+ "Subject: $str_ru_autoreply { \$ticket->subject }\n"
."\n"
."hi there it's an autoreply.\n"
."\n"
@@ -152,9 +152,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => 'test',
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => 'test',
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -174,9 +174,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => $str_ru_test,
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => $str_ru_test,
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -195,7 +195,7 @@
diag "set non-ascii subject tag for the queue" if $ENV{'TEST_VERBOSE'};
{
- my ($status, $msg) = $queue->SetSubjectTag( $str_ru_support );
+ my ($status, $msg) = $queue->set_subject_tag( $str_ru_support );
ok $status, "set subject tag for the queue" or diag "error: $msg";
}
@@ -204,9 +204,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => $str_ru_test,
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => $str_ru_test,
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -227,18 +227,18 @@
diag "flush subject tag of the queue" if $ENV{'TEST_VERBOSE'};
{
- my ($status, $msg) = $queue->SetSubjectTag( undef );
+ my ($status, $msg) = $queue->set_subject_tag( undef );
ok $status, "set subject tag for the queue" or diag "error: $msg";
}
diag "don't change subject via template" if $ENV{'TEST_VERBOSE'};
{
- my $template = RT::Template->new( $RT::SystemUser );
- $template->Load('Autoreply');
+ my $template = RT::Model::Template->new( current_user => RT->system_user );
+ $template->load('Autoreply');
ok $template->id, "loaded autoreply tempalte";
- my ($status, $msg) = $template->SetContent(
+ my ($status, $msg) = $template->set_content(
"\n"
."\n"
."hi there it's an autoreply.\n"
@@ -251,9 +251,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => $str_ru_test,
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => $str_ru_test,
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -270,7 +270,7 @@
diag "set non-ascii subject tag for the queue" if $ENV{'TEST_VERBOSE'};
{
- my ($status, $msg) = $queue->SetSubjectTag( $str_ru_support );
+ my ($status, $msg) = $queue->set_subject_tag( $str_ru_support );
ok $status, "set subject tag for the queue" or diag "error: $msg";
}
@@ -279,9 +279,9 @@
{
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
$ticket->create(
- Queue => $queue->id,
- Subject => $str_ru_test,
- Requestor => 'root at localhost',
+ queue => $queue->id,
+ subject => $str_ru_test,
+ requestor => 'root at localhost',
);
my @mails = RT::Test->fetch_caught_mails;
ok @mails, "got some outgoing emails";
@@ -302,7 +302,7 @@
my $mail = shift;
require RT::EmailParser;
my $parser = new RT::EmailParser;
- $parser->ParseMIMEEntityFromScalar( $mail );
- return $parser->Entity;
+ $parser->parse_mime_entity_from_scalar( $mail );
+ return $parser->entity;
}
Modified: rt/branches/3.999-DANGEROUS/t/maildigest/attributes.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/maildigest/attributes.t (original)
+++ rt/branches/3.999-DANGEROUS/t/maildigest/attributes.t Fri Aug 22 23:39:15 2008
@@ -1,24 +1,24 @@
#!/usr/bin/perl -w
use warnings;
+use RT::Test;
use strict;
use Test::More tests => 31;
use RT;
-use RT::Test;
my @users = qw/ emailnormal at example.com emaildaily at example.com emailweekly at example.com emailsusp at example.com /;
my( $ret, $msg );
-my $user_n = RT::Model::User->new(current_user => RT->system_user );
+my $user_n = RT::Model::User->new( current_user => RT->system_user );
( $ret, $msg ) = $user_n->load_or_create_by_email( $users[0] );
ok( $ret, "user with default email prefs created: $msg" );
$user_n->set_privileged( 1 );
-my $user_d = RT::Model::User->new(current_user => RT->system_user );
+my $user_d = RT::Model::User->new( current_user => RT->system_user );
( $ret, $msg ) = $user_d->load_or_create_by_email( $users[1] );
ok( $ret, "user with daily digest email prefs created: $msg" );
# Set a username & password for testing the interface.
$user_d->set_privileged( 1 );
-$user_d->set_preferences($RT::System => { %{ $user_d->Preferences( $RT::System ) || {}}, EmailFrequency => 'Daily digest'});
+$user_d->set_preferences($RT::system => { %{ $user_d->preferences( $RT::System ) || {}}, email_frequency => 'Daily digest'});
@@ -26,97 +26,97 @@
( $ret, $msg ) = $user_w->load_or_create_by_email( $users[2] );
ok( $ret, "user with weekly digest email prefs created: $msg" );
$user_w->set_privileged( 1 );
-$user_w->set_preferences($RT::System => { %{ $user_w->Preferences( $RT::System ) || {}}, EmailFrequency => 'Weekly digest'});
+$user_w->set_preferences($RT::system => { %{ $user_w->preferences( $RT::System ) || {}}, email_frequency => 'Weekly digest'});
my $user_s = RT::Model::User->new(current_user => RT->system_user );
( $ret, $msg ) = $user_s->load_or_create_by_email( $users[3] );
ok( $ret, "user with suspended email prefs created: $msg" );
-$user_s->set_preferences($RT::System => { %{ $user_s->Preferences( $RT::System ) || {}}, EmailFrequency => 'Suspended'});
+$user_s->set_preferences($RT::system => { %{ $user_s->preferences( $RT::System ) || {}}, email_frequency => 'Suspended'});
$user_s->set_privileged( 1 );
-is(RT::Config->Get('EmailFrequency' => $user_s), 'Suspended');
+is(RT->config->get('EmailFrequency' => $user_s), 'Suspended');
# Make a testing queue for ourselves.
my $testq = RT::Model::Queue->new(current_user => RT->system_user );
-if( $testq->ValidateName( 'EmailDigest-testqueue' ) ) {
+if( $testq->validate_name( 'EmailDigest-testqueue' ) ) {
( $ret, $msg ) = $testq->create( name => 'EmailDigest-testqueue' );
ok( $ret, "Our test queue is created: $msg" );
} else {
- $testq->Load( 'EmailDigest-testqueue' );
+ $testq->load( 'EmailDigest-testqueue' );
ok( $testq->id, "Our test queue is loaded" );
}
# Allow anyone to open a ticket on the test queue.
my $everyone = RT::Model::Group->new(current_user => RT->system_user );
-( $ret, $msg ) = $everyone->LoadSystemInternalGroup( 'Everyone' );
+( $ret, $msg ) = $everyone->load_system_internal_group( 'Everyone' );
ok( $ret, "Loaded 'everyone' group: $msg" );
-( $ret, $msg ) = $everyone->principal_object->grant_right( Right => 'CreateTicket',
- Object => $testq );
+( $ret, $msg ) = $everyone->principal_object->grant_right( right => 'CreateTicket',
+ object => $testq );
ok( $ret || $msg =~ /already has/, "Granted everyone CreateTicket on testq: $msg" );
# Make user_d an admincc for the queue.
-( $ret, $msg ) = $user_d->principal_object->grant_right( Right => 'AdminQueue',
- Object => $testq );
+( $ret, $msg ) = $user_d->principal_object->grant_right( right => 'AdminQueue',
+ object => $testq );
ok( $ret || $msg =~ /already has/, "Granted dduser AdminQueue on testq: $msg" );
-( $ret, $msg ) = $testq->AddWatcher( Type => 'AdminCc',
+( $ret, $msg ) = $testq->add_watcher( type => 'AdminCc',
principal_id => $user_d->principal_object->id );
ok( $ret || $msg =~ /already/, "dduser added as a queue watcher: $msg" );
# Give the others queue rights.
-( $ret, $msg ) = $user_n->principal_object->grant_right( Right => 'AdminQueue',
- Object => $testq );
+( $ret, $msg ) = $user_n->principal_object->grant_right( right => 'AdminQueue',
+ object => $testq );
ok( $ret || $msg =~ /already has/, "Granted emailnormal right on testq: $msg" );
-( $ret, $msg ) = $user_w->principal_object->grant_right( Right => 'AdminQueue',
- Object => $testq );
+( $ret, $msg ) = $user_w->principal_object->grant_right( right => 'AdminQueue',
+ object => $testq );
ok( $ret || $msg =~ /already has/, "Granted emailweekly right on testq: $msg" );
-( $ret, $msg ) = $user_s->principal_object->grant_right( Right => 'AdminQueue',
- Object => $testq );
+( $ret, $msg ) = $user_s->principal_object->grant_right( right => 'AdminQueue',
+ object => $testq );
ok( $ret || $msg =~ /already has/, "Granted emailsusp right on testq: $msg" );
# Create a ticket with To: Cc: Bcc: fields using our four users.
my $id;
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
-( $id, $ret, $msg ) = $ticket->create( Queue => $testq->Name,
- Requestor => [ $user_w->Name ],
- Subject => 'Test ticket for RT::Extension::EmailDigest',
+( $id, $ret, $msg ) = $ticket->create( queue => $testq->name,
+ requestor => [ $user_w->name ],
+ subject => 'Test ticket for RT::Extension::EmailDigest',
);
ok( $ret, "Ticket $id created: $msg" );
# Make the other users ticket watchers.
-( $ret, $msg ) = $ticket->AddWatcher( Type => 'Cc',
+( $ret, $msg ) = $ticket->add_watcher( type => 'Cc',
principal_id => $user_n->principal_object->id );
ok( $ret, "Added user_w as a ticket watcher: $msg" );
-( $ret, $msg ) = $ticket->AddWatcher( Type => 'Cc',
+( $ret, $msg ) = $ticket->add_watcher( type => 'Cc',
principal_id => $user_s->principal_object->id );
ok( $ret, "Added user_s as a ticket watcher: $msg" );
my $obj;
-($id, $msg, $obj ) = $ticket->Correspond(
- Content => "This is a ticket response for CC action" );
+($id, $msg, $obj ) = $ticket->correspond(
+ content => "This is a ticket response for CC action" );
ok( $ret, "Transaction created: $msg" );
# Get the deferred notifications that should result. Should be two for
# email daily, and one apiece for emailweekly and emailsusp.
my @notifications;
-my $txns = RT::Transactions->new( $RT::SystemUser );
-$txns->LimitToTicket( $ticket->id );
+my $txns = RT::Model::TransactionCollection->new( current_user => RT->system_user );
+$txns->limit_to_ticket( $ticket->id );
my( $c_daily, $c_weekly, $c_susp ) = ( 0, 0, 0 );
while( my $txn = $txns->next ) {
- my @daily_rcpt = $txn->DeferredRecipients( 'daily' );
- my @weekly_rcpt = $txn->DeferredRecipients('weekly' );
- my @susp_rcpt = $txn->DeferredRecipients( 'susp' );
+ my @daily_rcpt = $txn->deferred_recipients( 'daily' );
+ my @weekly_rcpt = $txn->deferred_recipients('weekly' );
+ my @susp_rcpt = $txn->deferred_recipients( 'susp' );
$c_daily++ if @daily_rcpt;
$c_weekly++ if @weekly_rcpt;
$c_susp++ if @susp_rcpt;
# If the transaction has content...
- if( $txn->ContentObj ) {
+ if( $txn->content_obj ) {
# ...none of the deferred folk should be in the header.
- my $headerstr = $txn->ContentObj->Headers;
+ my $headerstr = $txn->content_obj->headers;
foreach my $rcpt( @daily_rcpt, @weekly_rcpt, @susp_rcpt ) {
ok( $headerstr !~ /$rcpt/, "Deferred recipient $rcpt not found in header" );
}
Modified: rt/branches/3.999-DANGEROUS/t/ticket/action_linear_escalate.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/action_linear_escalate.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/action_linear_escalate.t Fri Aug 22 23:39:15 2008
@@ -2,17 +2,17 @@
use strict;
use warnings;
+use RT::Test;
use Test::More tests => 17;
use RT;
-use RT::Test;
my ($id, $msg);
my $RecordTransaction;
my $UpdateLastUpdated;
-use_ok('RT::Action::LinearEscalate');
+use_ok('RT::ScripAction::LinearEscalate');
my $q = RT::Test->load_or_create_queue( name => 'Regression' );
ok $q && $q->id, 'loaded or created queue';
@@ -20,46 +20,45 @@
# rt-cron-tool uses Gecos name to get rt user, so we'd better create one
my $gecos = RT::Test->load_or_create_user(
name => 'gecos',
- Password => 'password',
- Gecos => ($^O eq 'MSWin32') ? Win32::LoginName() : (getpwuid($<))[0],
+ password => 'password',
+ gecos => ($^O eq 'MSWin32') ? Win32::LoginName() : (getpwuid($<))[0],
);
ok $gecos && $gecos->id, 'loaded or created gecos user';
# get rid of all right permissions
-$gecos->principal_object->grant_right( Right => 'SuperUser' );
+$gecos->principal_object->grant_right( right => 'SuperUser' );
my $user = RT::Test->load_or_create_user(
- name => 'user', Password => 'password',
+ name => 'user', password => 'password',
);
ok $user && $user->id, 'loaded or created user';
-$user->principal_object->grant_right( Right => 'SuperUser' );
-my $current_user = RT::CurrentUser->new($RT::SystemUser);
-($id, $msg) = $current_user->Load($user->id);
-ok( $id, "Got current user? $msg" );
+$user->principal_object->grant_right( right => 'SuperUser' );
+my $current_user = RT::CurrentUser->new( id => RT->system_user->id );
+is( $id, $current_user->id, "Got current user?" );
#defaults
$RecordTransaction = 0;
$UpdateLastUpdated = 1;
my $ticket2 = create_ticket_as_ok($current_user);
escalate_ticket_ok($ticket2);
-ok( $ticket2->LastUpdatedBy != $user->id, "Set LastUpdated" );
-ok( $ticket2->Transactions->Last->Type =~ /Create/i, "Did not record a transaction" );
+ok( $ticket2->last_updated_by != $user->id, "Set LastUpdated" );
+ok( $ticket2->transactions->last->type =~ /Create/i, "Did not record a transaction" );
$RecordTransaction = 1;
$UpdateLastUpdated = 1;
my $ticket1 = create_ticket_as_ok($current_user);
escalate_ticket_ok($ticket1);
-ok( $ticket1->LastUpdatedBy != $user->id, "Set LastUpdated" );
-ok( $ticket1->Transactions->Last->Type !~ /Create/i, "Recorded a transaction" );
+ok( $ticket1->last_updated_by != $user->id, "Set LastUpdated" );
+ok( $ticket1->transactions->last->type !~ /Create/i, "Recorded a transaction" );
$RecordTransaction = 0;
$UpdateLastUpdated = 0;
my $ticket3 = create_ticket_as_ok($current_user);
escalate_ticket_ok($ticket3);
-ok( $ticket3->LastUpdatedBy == $user->id, "Did not set LastUpdated" );
-ok( $ticket3->Transactions->Last->Type =~ /Create/i, "Did not record a transaction" );
+ok( $ticket3->last_updated_by == $user->id, "Did not set LastUpdated" );
+ok( $ticket3->transactions->last->type =~ /Create/i, "Did not record a transaction" );
1;
@@ -67,24 +66,24 @@
sub create_ticket_as_ok {
my $user = shift;
- my $created = RT::Date->new($RT::SystemUser);
- $created->Unix(time() - ( 7 * 24 * 60**2 ));
- my $due = RT::Date->new($RT::SystemUser);
- $due->Unix(time() + ( 7 * 24 * 60**2 ));
+ my $created = RT::Date->new( current_user => RT->system_user );
+ $created->unix(time() - ( 7 * 24 * 60**2 ));
+ my $due = RT::Date->new( current_user => RT->system_user );
+ $due->unix(time() + ( 7 * 24 * 60**2 ));
my $ticket = RT::Model::Ticket->new($user);
- ($id, $msg) = $ticket->create( Queue => $q->id,
- Subject => "Escalation test",
- Priority => 0,
- InitialPriority => 0,
- FinalPriority => 50,
+ ($id, $msg) = $ticket->create( queue => $q->id,
+ subject => "Escalation test",
+ priority => 0,
+ initial_priority => 0,
+ final_priority => 50,
);
ok($id, "Created ticket? ".$id);
- $ticket->__Set( Field => 'Created',
- Value => $created->ISO,
+ $ticket->__set( field => 'Created',
+ value => $created->iso,
);
- $ticket->__Set( Field => 'Due',
- Value => $due->ISO,
+ $ticket->__set( field => 'Due',
+ value => $due->iso,
);
return $ticket;
@@ -93,9 +92,9 @@
sub escalate_ticket_ok {
my $ticket = shift;
my $id = $ticket->id;
- print "$RT::BinPath/rt-crontool --search RT::Search::FromSQL --search-arg \"id = @{[$id]}\" --action RT::Action::LinearEscalate --action-arg \"RecordTransaction:$RecordTransaction; UpdateLastUpdated:$UpdateLastUpdated\"\n";
- print STDERR `$RT::BinPath/rt-crontool --search RT::Search::FromSQL --search-arg "id = @{[$id]}" --action RT::Action::LinearEscalate --action-arg "RecordTransaction:$RecordTransaction; UpdateLastUpdated:$UpdateLastUpdated"`;
+ print "$RT::BinPath/rt-crontool --search RT::Search::FromSQL --search-arg \"id = @{[$id]}\" --action RT::ScripAction::LinearEscalate --action-arg \"RecordTransaction:$RecordTransaction; UpdateLastUpdated:$UpdateLastUpdated\"\n";
+ print STDERR `$RT::BinPath/rt-crontool --search RT::Search::FromSQL --search-arg "id = @{[$id]}" --action RT::ScripAction::LinearEscalate --action-arg "RecordTransaction:$RecordTransaction; UpdateLastUpdated:$UpdateLastUpdated"`;
- $ticket->Load($id); # reload, because otherwise we get the cached value
- ok( $ticket->Priority != 0, "Escalated ticket" );
+ $ticket->load($id); # reload, because otherwise we get the cached value
+ ok( $ticket->priority != 0, "Escalated ticket" );
}
Modified: rt/branches/3.999-DANGEROUS/t/ticket/add-watchers.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/add-watchers.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/add-watchers.t Fri Aug 22 23:39:15 2008
@@ -54,17 +54,18 @@
use RT::Model::Queue;
use RT::Model::User;
-use RT::Group;
+use RT::Model::Group;
use RT::Model::Ticket;
+use RT::Model::ACE;
use RT::CurrentUser;
# clear all global right
-my $acl = RT::ACL->new($RT::SystemUser);
-$acl->Limit( FIELD => 'RightName', OPERATOR => '!=', VALUE => 'SuperUser' );
-$acl->LimitToObject( $RT::System );
+my $acl = RT::Model::ACECollection->new(current_user => RT->system_user);
+$acl->limit( column => 'right_name', operator => '!=', value => 'SuperUser' );
+$acl->limit_to_object( RT->system );
while( my $ace = $acl->next ) {
- $ace->Delete;
+ $ace->delete;
}
# create new queue to be sure we do not mess with rights
@@ -77,81 +78,81 @@
my ($user_id) = $user->create( name => 'watcher'.$$,
email => "watcher$$".'@localhost',
privileged => 1,
- Password => 'qwe123',
+ password => 'qwe123',
);
-my $cu= RT::CurrentUser->new($user);
+my $cu= RT::CurrentUser->new( id => $user->id );
# make sure user can see tickets in the queue
my $principal = $user->principal_object;
ok( $principal, "principal loaded" );
-$principal->grant_right( Right => 'ShowTicket', Object => $queue );
-$principal->grant_right( Right => 'SeeQueue' , Object => $queue );
+$principal->grant_right( right => 'ShowTicket', object => $queue );
+$principal->grant_right( right => 'SeeQueue' , object => $queue );
-ok( $user->HasRight( Right => 'SeeQueue', Object => $queue ), "user can see queue" );
-ok( $user->HasRight( Right => 'ShowTicket', Object => $queue ), "user can show queue tickets" );
-ok( !$user->HasRight( Right => 'ModifyTicket', Object => $queue ), "user can't modify queue tickets" );
-ok( !$user->HasRight( Right => 'Watch', Object => $queue ), "user can't watch queue tickets" );
+ok( $user->has_right( right => 'SeeQueue', object => $queue ), "user can see queue" );
+ok( $user->has_right( right => 'ShowTicket', object => $queue ), "user can show queue tickets" );
+ok( !$user->has_right( right => 'ModifyTicket', object => $queue ), "user can't modify queue tickets" );
+ok( !$user->has_right( right => 'Watch', object => $queue ), "user can't watch queue tickets" );
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user );
-my ($rv, $msg) = $ticket->create( Subject => 'watcher tests', Queue => $queue->Name );
+my ($rv, $msg) = $ticket->create( subject => 'watcher tests', queue => $queue->name );
ok( $ticket->id, "ticket created" );
my $ticket2 = RT::Model::Ticket->new(current_user => $cu );
-$ticket2->Load( $ticket->id );
-ok( $ticket2->Subject, "ticket load by user" );
+$ticket2->load( $ticket->id );
+ok( $ticket2->subject, "ticket load by user" );
# user can add self to ticket only after getting Watch right
-($rv, $msg) = $ticket2->AddWatcher( Type => 'Cc', principal_id => $user->principal_id );
+($rv, $msg) = $ticket2->add_watcher( type => 'cc', principal_id => $user->principal_id );
ok( !$rv, "user can't add self as Cc" );
-($rv, $msg) = $ticket2->AddWatcher( Type => 'Requestor', principal_id => $user->principal_id );
+($rv, $msg) = $ticket2->add_watcher( type => 'requestor', principal_id => $user->principal_id );
ok( !$rv, "user can't add self as Requestor" );
-$principal->grant_right( Right => 'Watch' , Object => $queue );
-ok( $user->HasRight( Right => 'Watch', Object => $queue ), "user can watch queue tickets" );
-($rv, $msg) = $ticket2->AddWatcher( Type => 'Cc', principal_id => $user->principal_id );
+$principal->grant_right( right => 'Watch' , object => $queue );
+ok( $user->has_right( right => 'Watch', object => $queue ), "user can watch queue tickets" );
+($rv, $msg) = $ticket2->add_watcher( type => 'cc', principal_id => $user->principal_id );
ok( $rv, "user can add self as Cc by principal_id" );
-($rv, $msg) = $ticket2->AddWatcher( Type => 'Requestor', principal_id => $user->principal_id );
+($rv, $msg) = $ticket2->add_watcher( type => 'requestor', principal_id => $user->principal_id );
ok( $rv, "user can add self as Requestor by principal_id" );
# remove user and try adding with Email address
-($rv, $msg) = $ticket->DeleteWatcher( Type => 'Cc', principal_id => $user->principal_id );
+($rv, $msg) = $ticket->delete_watcher( type => 'cc', principal_id => $user->principal_id );
ok( $rv, "watcher removed by principal_id" );
-($rv, $msg) = $ticket->DeleteWatcher( Type => 'Requestor', Email => $user->email );
+($rv, $msg) = $ticket->delete_watcher( type => 'requestor', email => $user->email );
ok( $rv, "watcher removed by Email" );
-($rv, $msg) = $ticket2->AddWatcher( Type => 'Cc', Email => $user->email );
+($rv, $msg) = $ticket2->add_watcher( type => 'cc', email => $user->email );
ok( $rv, "user can add self as Cc by Email" );
-($rv, $msg) = $ticket2->AddWatcher( Type => 'Requestor', Email => $user->email );
+($rv, $msg) = $ticket2->add_watcher( type => 'requestor', email => $user->email );
ok( $rv, "user can add self as Requestor by Email" );
# Queue watcher tests
-$principal->revoke_right( Right => 'Watch' , Object => $queue );
-ok( !$user->HasRight( Right => 'Watch', Object => $queue ), "user queue watch right revoked" );
+$principal->revoke_right( right => 'Watch' , object => $queue );
+ok( !$user->has_right( right => 'Watch', object => $queue ), "user queue watch right revoked" );
-my $queue2 = RT::Model::Queue->new( $cu );
-($rv, $msg) = $queue2->Load( $queue->id );
+my $queue2 = RT::Model::Queue->new( current_user => $cu );
+($rv, $msg) = $queue2->load( $queue->id );
ok( $rv, "user loaded queue" );
# user can add self to queue only after getting Watch right
-($rv, $msg) = $queue2->AddWatcher( Type => 'Cc', principal_id => $user->principal_id );
+($rv, $msg) = $queue2->add_watcher( type => 'cc', principal_id => $user->principal_id );
ok( !$rv, "user can't add self as Cc" );
-($rv, $msg) = $queue2->AddWatcher( Type => 'Requestor', principal_id => $user->principal_id );
+($rv, $msg) = $queue2->add_watcher( type => 'requestor', principal_id => $user->principal_id );
ok( !$rv, "user can't add self as Requestor" );
-$principal->grant_right( Right => 'Watch' , Object => $queue );
-ok( $user->HasRight( Right => 'Watch', Object => $queue ), "user can watch queue queues" );
-($rv, $msg) = $queue2->AddWatcher( Type => 'Cc', principal_id => $user->principal_id );
+$principal->grant_right( right => 'Watch' , object => $queue );
+ok( $user->has_right( right => 'Watch', object => $queue ), "user can watch queue queues" );
+($rv, $msg) = $queue2->add_watcher( type => 'cc', principal_id => $user->principal_id );
ok( $rv, "user can add self as Cc by principal_id" );
-($rv, $msg) = $queue2->AddWatcher( Type => 'Requestor', principal_id => $user->principal_id );
+($rv, $msg) = $queue2->add_watcher( type => 'requestor', principal_id => $user->principal_id );
ok( $rv, "user can add self as Requestor by principal_id" );
# remove user and try adding with Email address
-($rv, $msg) = $queue->DeleteWatcher( Type => 'Cc', principal_id => $user->principal_id );
+($rv, $msg) = $queue->delete_watcher( type => 'cc', principal_id => $user->principal_id );
ok( $rv, "watcher removed by principal_id" );
-($rv, $msg) = $queue->DeleteWatcher( Type => 'Requestor', Email => $user->email );
+($rv, $msg) = $queue->delete_watcher( type => 'requestor', email => $user->email );
ok( $rv, "watcher removed by Email" );
-($rv, $msg) = $queue2->AddWatcher( Type => 'Cc', Email => $user->email );
+($rv, $msg) = $queue2->add_watcher( type => 'cc', email => $user->email );
ok( $rv, "user can add self as Cc by Email" );
-($rv, $msg) = $queue2->AddWatcher( Type => 'Requestor', Email => $user->email );
+($rv, $msg) = $queue2->add_watcher( type => 'requestor', email => $user->email );
ok( $rv, "user can add self as Requestor by Email" );
Modified: rt/branches/3.999-DANGEROUS/t/ticket/badlinks.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/badlinks.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/badlinks.t Fri Aug 22 23:39:15 2008
@@ -1,19 +1,19 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 12;
use RT::Test;
+use Test::More tests => 12;
my ($baseurl, $m) = RT::Test->started_ok;
ok($m->login, "Logged in");
-my $queue = RT::Test->load_or_create_queue(Name => 'General');
-ok($queue->Id, "loaded the General queue");
+my $queue = RT::Test->load_or_create_queue(name => 'General');
+ok($queue->id, "loaded the General queue");
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user);
my ($tid, $txn, $msg) = $ticket->create(
- Queue => $queue->id,
- Subject => 'test links',
+ queue => $queue->id,
+ subject => 'test links',
);
ok $tid, 'created a ticket #'. $tid or diag "error: $msg";
Modified: rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-multiple.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-multiple.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-multiple.t Fri Aug 22 23:39:15 2008
@@ -8,7 +8,7 @@
use RT::Model::TicketCollection;
use RT::Model::Queue;
-use RT::CustomField;
+use RT::Model::CustomField;
# Test Sorting by custom fields.
@@ -28,11 +28,11 @@
my $cf_name = "Order$$";
my $cf;
{
- $cf = RT::CustomField->new( $RT::SystemUser );
+ $cf = RT::Model::CustomField->new( current_user => RT->system_user );
my ($ret, $msg) = $cf->create(
- Name => $cf_name,
- Queue => $queue->id,
- Type => 'FreeformMultiple',
+ name => $cf_name,
+ queue => $queue->id,
+ type => 'FreeformMultiple',
);
ok($ret, "Custom Field Order created");
}
@@ -56,8 +56,8 @@
my $subject = join(",", sort @values) || '-';
my ( $id, undef $msg ) = $t->create(
%args,
- Queue => $queue->id,
- Subject => $subject,
+ queue => $queue->id,
+ subject => $subject,
);
ok( $id, "ticket created" ) or diag("error: $msg");
push @res, $t;
@@ -76,36 +76,36 @@
my $error = 0;
my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user );
$tix->from_sql( $query );
- $tix->OrderBy( FIELD => $test->{'Order'}, ORDER => $order );
+ $tix->order_by( field => $test->{'Order'}, order => $order );
ok($tix->count, "found ticket(s)")
or $error = 1;
my ($order_ok, $last) = (1, $order eq 'ASC'? '-': 'zzzzzz');
- my $last_id = $tix->Last->id;
+ my $last_id = $tix->last->id;
while ( my $t = $tix->next ) {
my $tmp;
- next if $t->id == $last_id and $t->Subject eq "-"; # Nulls are allowed to come last, in Pg
+ next if $t->id == $last_id and $t->subject eq "-"; # Nulls are allowed to come last, in Pg
if ( $order eq 'ASC' ) {
- $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->Subject))[0]);
+ $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->subject))[0]);
} else {
- $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->Subject))[-1]);
+ $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->subject))[-1]);
}
if ( $tmp > 0 ) {
$order_ok = 0; last;
}
- $last = $t->Subject;
+ $last = $t->subject;
}
ok( $order_ok, "$order order of tickets is good" )
or $error = 1;
if ( $error ) {
- diag "Wrong SQL query:". $tix->BuildSelectQuery;
- $tix->GotoFirstItem;
+ diag "Wrong SQL query:". $tix->build_select_query;
+ $tix->goto_first_item;
while ( my $t = $tix->next ) {
- diag sprintf "%02d - %s", $t->id, $t->Subject;
+ diag sprintf "%02d - %s", $t->id, $t->subject;
}
}
}
@@ -114,25 +114,25 @@
@data = (
{ },
- { CF => ['b', 'd'] },
- { CF => ['a', 'c'] },
+ { cf => ['b', 'd'] },
+ { cf => ['a', 'c'] },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "CF.{$cf_name}" },
- { Order => "CF.$queue_name.{$cf_name}" },
+ { order => "CF.{$cf_name}" },
+ { order => "CF.$queue_name.{$cf_name}" },
);
run_tests();
@data = (
- { CF => ['m', 'a'] },
- { CF => ['m'] },
- { CF => ['m', 'o'] },
+ { cf => ['m', 'a'] },
+ { cf => ['m'] },
+ { cf => ['m', 'o'] },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "CF.{$cf_name}", Query => "CF.{$cf_name} = 'm'" },
- { Order => "CF.$queue_name.{$cf_name}", Query => "CF.{$cf_name} = 'm'" },
+ { order => "CF.{$cf_name}", query => "CF.{$cf_name} = 'm'" },
+ { order => "CF.$queue_name.{$cf_name}", query => "CF.{$cf_name} = 'm'" },
);
run_tests();
Modified: rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-single.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-single.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/cfsort-freeform-single.t Fri Aug 22 23:39:15 2008
@@ -8,7 +8,7 @@
use RT::Model::TicketCollection;
use RT::Model::Queue;
-use RT::CustomField;
+use RT::Model::CustomField;
# Test Sorting by FreeformSingle custom field.
@@ -31,11 +31,11 @@
diag "create a CF\n" if $ENV{TEST_VERBOSE};
{
$cf_name = $CF{'CF'}{'name'} = "Order$$";
- $CF{'CF'}{'obj'} = RT::CustomField->new( $RT::SystemUser );
+ $CF{'CF'}{'obj'} = RT::Model::CustomField->new( current_user => RT->system_user );
my ($ret, $msg) = $CF{'CF'}{'obj'}->create(
- Name => $CF{'CF'}{'name'},
- Queue => $queue->id,
- Type => 'FreeformSingle',
+ name => $CF{'CF'}{'name'},
+ queue => $queue->id,
+ type => 'FreeformSingle',
);
ok($ret, "Custom Field $CF{'CF'}{'name'} created");
}
@@ -65,8 +65,8 @@
my ( $id, undef $msg ) = $t->create(
%args,
- Queue => $queue->id,
- Subject => $subject,
+ queue => $queue->id,
+ subject => $subject,
);
ok( $id, "ticket created" ) or diag("error: $msg");
push @res, $t;
@@ -85,36 +85,36 @@
my $error = 0;
my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user );
$tix->from_sql( $query );
- $tix->OrderBy( FIELD => $test->{'Order'}, ORDER => $order );
+ $tix->order_by( field => $test->{'Order'}, order => $order );
ok($tix->count, "found ticket(s)")
or $error = 1;
my ($order_ok, $last) = (1, $order eq 'ASC'? '-': 'zzzzzz');
- my $last_id = $tix->Last->id;
+ my $last_id = $tix->last->id;
while ( my $t = $tix->next ) {
my $tmp;
- next if $t->id == $last_id and $t->Subject eq "-"; # Nulls are allowed to come last, in Pg
+ next if $t->id == $last_id and $t->subject eq "-"; # Nulls are allowed to come last, in Pg
if ( $order eq 'ASC' ) {
- $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->Subject))[0]);
+ $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->subject))[0]);
} else {
- $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->Subject))[-1]);
+ $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->subject))[-1]);
}
if ( $tmp > 0 ) {
$order_ok = 0; last;
}
- $last = $t->Subject;
+ $last = $t->subject;
}
ok( $order_ok, "$order order of tickets is good" )
or $error = 1;
if ( $error ) {
- diag "Wrong SQL query:". $tix->BuildSelectQuery;
- $tix->GotoFirstItem;
+ diag "Wrong SQL query:". $tix->build_select_query;
+ $tix->goto_first_item;
while ( my $t = $tix->next ) {
- diag sprintf "%02d - %s", $t->id, $t->Subject;
+ diag sprintf "%02d - %s", $t->id, $t->subject;
}
}
}
@@ -123,38 +123,38 @@
@data = (
{ },
- { CF => 'a' },
- { CF => 'b' },
+ { cf => 'a' },
+ { cf => 'b' },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "CF.{$cf_name}" },
- { Order => "CF.$queue_name.{$cf_name}" },
+ { order => "CF.{$cf_name}" },
+ { order => "CF.$queue_name.{$cf_name}" },
);
run_tests();
@data = (
{ },
- { CF => 'aa' },
- { CF => 'ab' },
+ { cf => 'aa' },
+ { cf => 'ab' },
);
@tickets = add_tix_from_data();
@test = (
- { Query => "CF.{$cf_name} LIKE 'a'", Order => "CF.{$cf_name}" },
- { Query => "CF.{$cf_name} LIKE 'a'", Order => "CF.$queue_name.{$cf_name}" },
+ { query => "CF.{$cf_name} LIKE 'a'", order => "CF.{$cf_name}" },
+ { query => "CF.{$cf_name} LIKE 'a'", order => "CF.$queue_name.{$cf_name}" },
);
run_tests();
@data = (
- { Subject => '-', },
- { Subject => 'a', CF => 'a' },
- { Subject => 'b', CF => 'b' },
- { Subject => 'c', CF => 'c' },
+ { subject => '-', },
+ { subject => 'a', cf => 'a' },
+ { subject => 'b', cf => 'b' },
+ { subject => 'c', cf => 'c' },
);
@tickets = add_tix_from_data();
@test = (
- { Query => "CF.{$cf_name} != 'c'", Order => "CF.{$cf_name}" },
- { Query => "CF.{$cf_name} != 'c'", Order => "CF.$queue_name.{$cf_name}" },
+ { query => "CF.{$cf_name} != 'c'", order => "CF.{$cf_name}" },
+ { query => "CF.{$cf_name} != 'c'", order => "CF.$queue_name.{$cf_name}" },
);
run_tests();
@@ -163,28 +163,28 @@
diag "create another CF\n" if $ENV{TEST_VERBOSE};
{
$CF{'AnotherCF'}{'name'} = "OrderAnother$$";
- $CF{'AnotherCF'}{'obj'} = RT::CustomField->new( $RT::SystemUser );
+ $CF{'AnotherCF'}{'obj'} = RT::Model::CustomField->new( current_user => RT->system_user );
my ($ret, $msg) = $CF{'AnotherCF'}{'obj'}->create(
- Name => $CF{'AnotherCF'}{'name'},
- Queue => $queue->id,
- Type => 'FreeformSingle',
+ name => $CF{'AnotherCF'}{'name'},
+ queue => $queue->id,
+ type => 'FreeformSingle',
);
ok($ret, "Custom Field $CF{'AnotherCF'}{'name'} created");
}
# test that order is not affect by other fields (had such problem)
@data = (
- { Subject => '-', },
- { Subject => 'a', CF => 'a', AnotherCF => 'za' },
- { Subject => 'b', CF => 'b', AnotherCF => 'ya' },
- { Subject => 'c', CF => 'c', AnotherCF => 'xa' },
+ { subject => '-', },
+ { subject => 'a', cf => 'a', another_cf => 'za' },
+ { subject => 'b', cf => 'b', another_cf => 'ya' },
+ { subject => 'c', cf => 'c', another_cf => 'xa' },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "CF.{$cf_name}" },
- { Order => "CF.$queue_name.{$cf_name}" },
- { Query => "CF.{$cf_name} != 'c'", Order => "CF.{$cf_name}" },
- { Query => "CF.{$cf_name} != 'c'", Order => "CF.$queue_name.{$cf_name}" },
+ { order => "CF.{$cf_name}" },
+ { order => "CF.$queue_name.{$cf_name}" },
+ { query => "CF.{$cf_name} != 'c'", order => "CF.{$cf_name}" },
+ { query => "CF.{$cf_name} != 'c'", order => "CF.$queue_name.{$cf_name}" },
);
run_tests();
Modified: rt/branches/3.999-DANGEROUS/t/ticket/search_long_cf_values.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/search_long_cf_values.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/search_long_cf_values.t Fri Aug 22 23:39:15 2008
@@ -5,30 +5,30 @@
use strict;
use warnings;
+use RT::Test;
use Test::More tests => 10;
-use RT::Test;
# setup the queue
my $q = RT::Model::Queue->new(current_user => RT->system_user);
my $queue = 'SearchTests-'.$$;
-$q->create(Name => $queue);
+$q->create(name => $queue);
ok ($q->id, "Created the queue");
# setup the CF
-my $cf = RT::CustomField->new($RT::SystemUser);
-$cf->create(Name => 'SearchTest', Type => 'Freeform', MaxValues => 0, Queue => $q->id);
+my $cf = RT::Model::CustomField->new( current_user => RT->system_user );
+$cf->create(name => 'SearchTest', type => 'Freeform', max_values => 0, queue => $q->id);
ok($cf->id, "Created the SearchTest CF");
-my $cflabel = "CustomField-".$cf->id;
+my $cflabel = "custom_field-".$cf->id;
# setup some tickets
my $t1 = RT::Model::Ticket->new(current_user => RT->system_user);
my ( $id, undef $msg ) = $t1->create(
- Queue => $q->id,
- Subject => 'SearchTest1',
- Requestor => ['search at example.com'],
+ queue => $q->id,
+ subject => 'SearchTest1',
+ requestor => ['search at example.com'],
$cflabel => 'foo',
);
ok( $id, $msg );
@@ -36,18 +36,18 @@
my $t2 = RT::Model::Ticket->new(current_user => RT->system_user);
( $id, undef, $msg ) = $t2->create(
- Queue => $q->id,
- Subject => 'SearchTest2',
- Requestor => ['searchlong at example.com'],
+ queue => $q->id,
+ subject => 'SearchTest2',
+ requestor => ['searchlong at example.com'],
$cflabel => 'bar' x 150,
);
ok( $id, $msg );
my $t3 = RT::Model::Ticket->new(current_user => RT->system_user);
( $id, undef, $msg ) = $t3->create(
- Queue => $q->id,
- Subject => 'SearchTest3',
- Requestor => ['searchlong at example.com'],
+ queue => $q->id,
+ subject => 'SearchTest3',
+ requestor => ['searchlong at example.com'],
$cflabel => 'bar',
);
ok( $id, $msg );
@@ -56,25 +56,25 @@
my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user);
$tix->from_sql("Queue = '$queue' AND CF.SearchTest LIKE 'foo'");
is($tix->count, 1, "matched short string foo")
- or diag "wrong results from SQL:\n". $tix->BuildSelectCountQuery;
+ or diag "wrong results from SQL:\n". $tix->build_select_count_query;
$tix = RT::Model::TicketCollection->new(current_user => RT->system_user);
$tix->from_sql("Queue = '$queue' AND CF.SearchTest LIKE 'bar'");
is($tix->count, 2, "matched long+short string bar")
- or diag "wrong results from SQL:\n". $tix->BuildSelectCountQuery;
+ or diag "wrong results from SQL:\n". $tix->build_select_count_query;
$tix = RT::Model::TicketCollection->new(current_user => RT->system_user);
$tix->from_sql("Queue = '$queue' AND ( CF.SearchTest LIKE 'foo' OR CF.SearchTest LIKE 'bar' )");
is($tix->count, 3, "matched short string foo or long+short string bar")
- or diag "wrong results from SQL:\n". $tix->BuildSelectCountQuery;
+ or diag "wrong results from SQL:\n". $tix->build_select_count_query;
$tix = RT::Model::TicketCollection->new(current_user => RT->system_user);
$tix->from_sql("Queue = '$queue' AND CF.SearchTest NOT LIKE 'foo' AND CF.SearchTest LIKE 'bar'");
is($tix->count, 2, "not matched short string foo and matched long+short string bar")
- or diag "wrong results from SQL:\n". $tix->BuildSelectCountQuery;
+ or diag "wrong results from SQL:\n". $tix->build_select_count_query;
$tix = RT::Model::TicketCollection->new(current_user => RT->system_user);
$tix->from_sql("Queue = '$queue' AND CF.SearchTest LIKE 'foo' AND CF.SearchTest NOT LIKE 'bar'");
is($tix->count, 1, "matched short string foo and not matched long+short string bar")
- or diag "wrong results from SQL:\n". $tix->BuildSelectCountQuery;
+ or diag "wrong results from SQL:\n". $tix->build_select_count_query;
Modified: rt/branches/3.999-DANGEROUS/t/ticket/sort-by-queue.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/sort-by-queue.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/sort-by-queue.t Fri Aug 22 23:39:15 2008
@@ -8,7 +8,7 @@
use RT::Model::TicketCollection;
use RT::Model::Queue;
-use RT::CustomField;
+use RT::Model::CustomField;
#########################################################
# Test sorting by Queue, we sort by its name
@@ -50,13 +50,13 @@
my $query_prefix = join ' OR ', map 'id = '. $_->id, @tickets;
foreach my $test ( @test ) {
my $query = join " AND ", map "( $_ )", grep defined && length,
- $query_prefix, $test->{'Query'};
+ $query_prefix, $test->{'query'};
foreach my $order (qw(ASC DESC)) {
my $error = 0;
my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user );
$tix->from_sql( $query );
- $tix->OrderBy( FIELD => $test->{'Order'}, ORDER => $order );
+ $tix->order_by( { column => $test->{'order'}, order => $order } );
ok($tix->count, "found ticket(s)")
or $error = 1;
@@ -65,24 +65,24 @@
while ( my $t = $tix->next ) {
my $tmp;
if ( $order eq 'ASC' ) {
- $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->Subject))[0]);
+ $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->subject))[0]);
} else {
- $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->Subject))[-1]);
+ $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->subject))[-1]);
}
if ( $tmp > 0 ) {
$order_ok = 0; last;
}
- $last = $t->Subject;
+ $last = $t->subject;
}
ok( $order_ok, "$order order of tickets is good" )
or $error = 1;
if ( $error ) {
- diag "Wrong SQL query:". $tix->BuildSelectQuery;
- $tix->GotoFirstItem;
+ diag "Wrong SQL query:". $tix->build_select_query;
+ $tix->goto_first_item;
while ( my $t = $tix->next ) {
- diag sprintf "%02d - %s", $t->id, $t->Subject;
+ diag sprintf "%02d %02d- %s", $t->queue_obj->id, $t->id, $t->subject;
}
}
}
@@ -90,12 +90,12 @@
}
@data = (
- { Queue => $qids[0], Subject => 'z' },
- { Queue => $qids[1], Subject => 'a' },
+ { queue => $qids[0], subject => 'z' },
+ { queue => $qids[1], subject => 'a' },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "Queue" },
+ { order => "queue" },
);
run_tests();
Modified: rt/branches/3.999-DANGEROUS/t/ticket/sort-by-user.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/sort-by-user.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/sort-by-user.t Fri Aug 22 23:39:15 2008
@@ -8,7 +8,7 @@
use RT::Model::TicketCollection;
use RT::Model::Queue;
-use RT::CustomField;
+use RT::Model::CustomField;
#########################################################
# Test sorting by Owner, Creator and LastUpdatedBy
@@ -39,9 +39,9 @@
);
ok $uid, "created user #$uid";
- my ($status, $msg) = $user->principal_object->grant_right( Right => 'OwnTicket', Object => $queue );
+ my ($status, $msg) = $user->principal_object->grant_right( right => 'OwnTicket', object => $queue );
ok $status, "granted right";
- ($status, $msg) = $user->principal_object->grant_right( Right => 'CreateTicket', Object => $queue );
+ ($status, $msg) = $user->principal_object->grant_right( right => 'CreateTicket', object => $queue );
ok $status, "granted right";
push @users, $user;
@@ -57,16 +57,16 @@
my $t = RT::Model::Ticket->new(current_user => RT->system_user);
my %args = %{ shift(@data) };
- my ( $id, undef, $msg ) = $t->create( %args, Queue => $queue->id );
+ my ( $id, undef, $msg ) = $t->create( %args, queue => $queue->id );
if ( $args{'Owner'} ) {
- is $t->Owner, $args{'Owner'}, "owner is correct";
+ is $t->owner, $args{'Owner'}, "owner is correct";
}
if ( $args{'Creator'} ) {
- is $t->Creator, $args{'Creator'}, "creator is correct";
+ is $t->creator, $args{'Creator'}, "creator is correct";
}
# hackish, but simpler
if ( $args{'LastUpdatedBy'} ) {
- $t->__Set( Field => 'LastUpdatedBy', Value => $args{'LastUpdatedBy'} );
+ $t->__Set( field => 'LastUpdatedBy', value => $args{'LastUpdatedBy'} );
}
ok( $id, "ticket created" ) or diag("error: $msg");
push @res, $t;
@@ -79,13 +79,13 @@
my $query_prefix = join ' OR ', map 'id = '. $_->id, @tickets;
foreach my $test ( @test ) {
my $query = join " AND ", map "( $_ )", grep defined && length,
- $query_prefix, $test->{'Query'};
+ $query_prefix, $test->{'query'};
foreach my $order (qw(ASC DESC)) {
my $error = 0;
my $tix = RT::Model::TicketCollection->new(current_user => RT->system_user );
$tix->from_sql( $query );
- $tix->OrderBy( FIELD => $test->{'Order'}, ORDER => $order );
+ $tix->order_by( { column => $test->{'order'}, order => $order } );
ok($tix->count, "found ticket(s)")
or $error = 1;
@@ -94,24 +94,24 @@
while ( my $t = $tix->next ) {
my $tmp;
if ( $order eq 'ASC' ) {
- $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->Subject))[0]);
+ $tmp = ((split( /,/, $last))[0] cmp (split( /,/, $t->subject))[0]);
} else {
- $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->Subject))[-1]);
+ $tmp = -((split( /,/, $last))[-1] cmp (split( /,/, $t->subject))[-1]);
}
if ( $tmp > 0 ) {
$order_ok = 0; last;
}
- $last = $t->Subject;
+ $last = $t->subject;
}
ok( $order_ok, "$order order of tickets is good" )
or $error = 1;
if ( $error ) {
- diag "Wrong SQL query:". $tix->BuildSelectQuery;
- $tix->GotoFirstItem;
+ diag "Wrong SQL query:". $tix->build_select_query;
+ $tix->goto_first_item;
while ( my $t = $tix->next ) {
- diag sprintf "%02d - %s", $t->id, $t->Subject;
+ diag sprintf "%02d - %s", $t->id, $t->subject;
}
}
}
@@ -119,35 +119,35 @@
}
@data = (
- { Subject => 'Nobody' },
- { Subject => 'Z', Owner => $uids[0] },
- { Subject => 'A', Owner => $uids[1] },
+ { subject => 'Nobody' },
+ { subject => 'Z', owner => $uids[0] },
+ { subject => 'A', owner => $uids[1] },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "Owner" },
+ { order => "Owner" },
);
run_tests();
@data = (
- { Subject => 'RT' },
- { Subject => 'Z', Creator => $uids[0] },
- { Subject => 'A', Creator => $uids[1] },
+ { subject => 'RT' },
+ { subject => 'Z', creator => $uids[0] },
+ { subject => 'A', creator => $uids[1] },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "Creator" },
+ { order => "Creator" },
);
run_tests();
@data = (
- { Subject => 'RT' },
- { Subject => 'Z', LastUpdatedBy => $uids[0] },
- { Subject => 'A', LastUpdatedBy => $uids[1] },
+ { subject => 'RT' },
+ { subject => 'Z', last_updated_by => $uids[0] },
+ { subject => 'A', last_updated_by => $uids[1] },
);
@tickets = add_tix_from_data();
@test = (
- { Order => "LastUpdatedBy" },
+ { order => "last_updated_by" },
);
run_tests();
Modified: rt/branches/3.999-DANGEROUS/t/web/cf_onqueue.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/cf_onqueue.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/cf_onqueue.t Fri Aug 22 23:39:15 2008
@@ -15,7 +15,7 @@
$m->title_is(q/Select a Custom Field/, 'admin-cf screen');
$m->follow_link( text => 'Create' );
$m->submit_form(
- form_name => "modify_custom_field",
+ form_name => 'modify_custom_field',
fields => {
type_composite => 'Freeform-1',
lookup_type => 'RT::Model::Queue',
@@ -36,7 +36,7 @@
$m->title_is(q/Edit Custom Fields for all queues/, 'global custom field for all queues configuration screen');
$m->content_like( qr/QueueCFTest/, 'CF QueueCFTest displayed on page' );
$m->submit_form(
- form_name => "EditCustomFields",
+ form_name => 'edit_custom_fields',
fields => {
'Object--CF-1' => '1',
},
Modified: rt/branches/3.999-DANGEROUS/t/web/dashboards-groups.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/dashboards-groups.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/dashboards-groups.t Fri Aug 22 23:39:15 2008
@@ -14,27 +14,27 @@
$user_obj->set_name('customer');
$user_obj->set_privileged(1);
($ok, $msg) = $user_obj->set_password('customer');
-$user_obj->principal_object->grant_right(Right => 'ModifySelf');
-my $currentuser = RT::CurrentUser->new($user_obj);
+$user_obj->principal_object->grant_right(right => 'ModifySelf');
+my $currentuser = RT::CurrentUser->new( id => $user_obj->id );
my $queue = RT::Model::Queue->new(current_user => RT->system_user);
-$queue->create(Name => 'SearchQueue'.$$);
+$queue->create(name => 'SearchQueue'.$$);
-$user_obj->principal_object->grant_right(Right => $_, Object => $queue)
+$user_obj->principal_object->grant_right(right => $_, object => $queue)
for qw/SeeQueue ShowTicket OwnTicket/;
# grant the user all these rights so we can make sure that the group rights
# are checked and not these as well
-$user_obj->principal_object->grant_right(Right => $_, Object => $RT::System)
+$user_obj->principal_object->grant_right(right => $_, object => $RT::System)
for qw/SubscribeDashboard CreateOwnDashboard SeeOwnDashboard ModifyOwnDashboard DeleteOwnDashboard/;
# }}}
# create and test groups (outer < inner < user) {{{
my $inner_group = RT::Model::Group->new(current_user => RT->system_user);
-($ok, $msg) = $inner_group->create_user_defined_group(Name => "inner", description => "inner group");
+($ok, $msg) = $inner_group->create_user_defined_group(name => "inner", description => "inner group");
ok($ok, "created inner group: $msg");
my $outer_group = RT::Model::Group->new(current_user => RT->system_user);
-($ok, $msg) = $outer_group->create_user_defined_group(Name => "outer", description => "outer group");
+($ok, $msg) = $outer_group->create_user_defined_group(name => "outer", description => "outer group");
ok($ok, "created outer group: $msg");
($ok, $msg) = $outer_group->add_member($inner_group->principal_id);
@@ -59,17 +59,17 @@
$m->get_ok("$url/Dashboards");
$m->follow_link_ok({text => "New dashboard"});
-$m->form_name('modify_dashboard');
-is_deeply([$m->current_form->find_input('Privacy')->possible_values], ["RT::Model::User-" . $user_obj->Id], "the only selectable privacy is user");
+$m->form_name( 'modify_dashboard' );
+is_deeply([$m->current_form->find_input('Privacy')->possible_values], ["RT::Model::User-" . $user_obj->id], "the only selectable privacy is user");
$m->content_lacks('Delete', "Delete button hidden because we are creating");
-$user_obj->principal_object->grant_right(Right => 'CreateGroupDashboard', Object => $inner_group);
+$user_obj->principal_object->grant_right(right => 'CreateGroupDashboard', object => $inner_group);
$m->follow_link_ok({text => "New dashboard"});
-$m->form_name('modify_dashboard');
-is_deeply([$m->current_form->find_input('Privacy')->possible_values], ["RT::Model::User-" . $user_obj->Id, "RT::Group-" . $inner_group->Id], "the only selectable privacies are user and inner group (not outer group)");
+$m->form_name( 'modify_dashboard' );
+is_deeply([$m->current_form->find_input('Privacy')->possible_values], ["RT::Model::User-" . $user_obj->id, "RT::Group-" . $inner_group->id], "the only selectable privacies are user and inner group (not outer group)");
$m->field("Name" => 'inner dashboard');
-$m->field("Privacy" => "RT::Group-" . $inner_group->Id);
+$m->field("Privacy" => "RT::Group-" . $inner_group->id);
$m->content_lacks('Delete', "Delete button hidden because we are creating");
$m->click_button(value => 'Save Changes');
@@ -80,17 +80,17 @@
my $dashboard = RT::Dashboard->new($currentuser);
my ($id) = $m->content =~ /name="id" value="(\d+)"/;
ok($id, "got an ID, $id");
-$dashboard->LoadById($id);
-is($dashboard->Name, "inner dashboard");
+$dashboard->load_by_id($id);
+is($dashboard->name, "inner dashboard");
-is($dashboard->Privacy, 'RT::Group-' . $inner_group->Id, "correct privacy");
-is($dashboard->PossibleHiddenSearches, 0, "all searches are visible");
+is($dashboard->privacy, 'RT::Group-' . $inner_group->id, "correct privacy");
+is($dashboard->possible_hidden_searches, 0, "all searches are visible");
$m->get_ok("/Dashboards/Modify.html?id=$id");
$m->content_lacks("inner dashboard", "no SeeGroupDashboard right");
$m->content_contains("Permission denied");
-$user_obj->principal_object->grant_right(Right => 'SeeGroupDashboard', Object => $inner_group);
+$user_obj->principal_object->grant_right(right => 'SeeGroupDashboard', object => $inner_group);
$m->get_ok("/Dashboards/Modify.html?id=$id");
$m->content_contains("inner dashboard", "we now have SeeGroupDashboard right");
$m->content_lacks("Permission denied");
Modified: rt/branches/3.999-DANGEROUS/t/web/dashboards.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/dashboards.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/dashboards.t Fri Aug 22 23:39:15 2008
@@ -13,14 +13,14 @@
$user_obj->set_name('customer');
$user_obj->set_privileged(1);
($ret, $msg) = $user_obj->set_password('customer');
-$user_obj->principal_object->grant_right(Right => 'ModifySelf');
-my $currentuser = RT::CurrentUser->new($user_obj);
+$user_obj->principal_object->grant_right(right => 'ModifySelf');
+my $currentuser = RT::CurrentUser->new( id => $user_obj->id );
my $queue = RT::Model::Queue->new(current_user => RT->system_user);
-$queue->create(Name => 'SearchQueue'.$$);
-$user_obj->principal_object->grant_right(Right => 'SeeQueue', Object => $queue);
-$user_obj->principal_object->grant_right(Right => 'ShowTicket', Object => $queue);
-$user_obj->principal_object->grant_right(Right => 'OwnTicket', Object => $queue);
+$queue->create(name => 'SearchQueue'.$$);
+$user_obj->principal_object->grant_right(right => 'SeeQueue', object => $queue);
+$user_obj->principal_object->grant_right(right => 'ShowTicket', object => $queue);
+$user_obj->principal_object->grant_right(right => 'OwnTicket', object => $queue);
ok $m->login(customer => 'customer'), "logged in";
@@ -31,14 +31,14 @@
$m->content_contains("Permission denied");
$m->content_lacks("Save Changes");
-$user_obj->principal_object->grant_right(Right => 'ModifyOwnDashboard', Object => $RT::System);
+$user_obj->principal_object->grant_right(right => 'ModifyOwnDashboard', object => $RT::System);
# Modify itself is no longer good enough, you need Create
$m->get_ok($url."Dashboards/Modify.html?Create=1");
$m->content_contains("Permission denied");
$m->content_lacks("Save Changes");
-$user_obj->principal_object->grant_right(Right => 'CreateOwnDashboard', Object => $RT::System);
+$user_obj->principal_object->grant_right(right => 'CreateOwnDashboard', object => $RT::System);
$m->get_ok($url."Dashboards/Modify.html?Create=1");
$m->content_lacks("Permission denied");
@@ -48,7 +48,7 @@
$m->content_contains("New dashboard", "'New dashboard' link because we now have ModifyOwnDashboard");
$m->follow_link_ok({text => "New dashboard"});
-$m->form_name('modify_dashboard');
+$m->form_name( 'modify_dashboard' );
$m->field("Name" => 'different dashboard');
$m->content_lacks('Delete', "Delete button hidden because we are creating");
$m->click_button(value => 'Save Changes');
@@ -59,7 +59,7 @@
$m->get_ok($url."Dashboards/index.html");
$m->content_lacks("different dashboard", "we lack SeeOwnDashboard");
-$user_obj->principal_object->grant_right(Right => 'SeeOwnDashboard', Object => $RT::System);
+$user_obj->principal_object->grant_right(right => 'SeeOwnDashboard', object => $RT::System);
$m->get_ok($url."Dashboards/index.html");
$m->content_contains("different dashboard", "we now have SeeOwnDashboard");
@@ -76,7 +76,7 @@
$m->follow_link_ok({text => "Queries"});
$m->content_contains("Modify the queries of dashboard different dashboard");
-$m->form_name('DashboardQueries');
+$m->form_name( 'dashboard_queries' );
$m->field('Searches-Available' => ["2-RT::System-1"]);
$m->click_button(name => 'add');
$m->content_contains("Dashboard updated");
@@ -84,36 +84,36 @@
my $dashboard = RT::Dashboard->new($currentuser);
my ($id) = $m->content =~ /name="id" value="(\d+)"/;
ok($id, "got an ID, $id");
-$dashboard->LoadById($id);
-is($dashboard->Name, "different dashboard");
+$dashboard->load_by_id($id);
+is($dashboard->name, "different dashboard");
-is($dashboard->Privacy, 'RT::Model::User-' . $user_obj->Id, "correct privacy");
-is($dashboard->PossibleHiddenSearches, 0, "all searches are visible");
+is($dashboard->privacy, 'RT::Model::User-' . $user_obj->id, "correct privacy");
+is($dashboard->possible_hidden_searches, 0, "all searches are visible");
-my @searches = $dashboard->Searches;
+my @searches = $dashboard->searches;
is(@searches, 1, "one saved search in the dashboard");
-like($searches[0]->Name, qr/newest unowned tickets/, "correct search name");
+like($searches[0]->name, qr/newest unowned tickets/, "correct search name");
-$m->form_name('DashboardQueries');
+$m->form_name( 'dashboard_queries' );
$m->field('Searches-Available' => ["1-RT::System-1"]);
$m->click_button(name => 'add');
$m->content_contains("Dashboard updated");
-RT::Record->FlushCache if RT::Record->can('FlushCache');
+RT::Record->flush_cache if RT::Record->can('FlushCache');
$dashboard = RT::Dashboard->new($currentuser);
-$dashboard->LoadById($id);
+$dashboard->load_by_id($id);
- at searches = $dashboard->Searches;
+ at searches = $dashboard->searches;
is(@searches, 2, "two saved searches in the dashboard");
-like($searches[0]->Name, qr/newest unowned tickets/, "correct existing search name");
-like($searches[1]->Name, qr/highest priority tickets I own/, "correct new search name");
+like($searches[0]->name, qr/newest unowned tickets/, "correct existing search name");
+like($searches[1]->name, qr/highest priority tickets I own/, "correct new search name");
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user);
$ticket->create(
- Queue => $queue->Id,
- Requestor => [ $user_obj->Name ],
- Owner => $user_obj,
- Subject => 'dashboard test',
+ queue => $queue->id,
+ requestor => [ $user_obj->name ],
+ owner => $user_obj,
+ subject => 'dashboard test',
);
$m->follow_link_ok({text => "Show"});
@@ -129,14 +129,14 @@
$m->content_contains("dashboard test", "ticket subject");
$m->get_ok("/Dashboards/Subscription.html?DashboardId=$id");
-$m->form_name('SubscribeDashboard');
+$m->form_name( 'subscribe_dashboard' );
$m->click_button(name => 'Save');
$m->content_contains("Permission denied");
-RT::Record->FlushCache if RT::Record->can('FlushCache');
-is($user_obj->Attributes->Named('Subscription'), 0, "no subscriptions");
+RT::Record->flush_cache if RT::Record->can('FlushCache');
+is($user_obj->attributes->named('Subscription'), 0, "no subscriptions");
-$user_obj->principal_object->grant_right(Right => 'SubscribeDashboard', Object => $RT::System);
+$user_obj->principal_object->grant_right(right => 'SubscribeDashboard', object => $RT::System);
$m->get_ok("/Dashboards/Modify.html?id=$id");
$m->follow_link_ok({text => "Subscription"});
@@ -145,15 +145,15 @@
$m->content_contains("My Tickets");
$m->content_lacks("Bookmarked Tickets", "only dashboard queries show up");
-$m->form_name('SubscribeDashboard');
+$m->form_name( 'subscribe_dashboard' );
$m->click_button(name => 'Save');
$m->content_lacks("Permission denied");
$m->content_contains("Subscribed to dashboard different dashboard");
-RT::Record->FlushCache if RT::Record->can('FlushCache');
+RT::Record->flush_cache if RT::Record->can('FlushCache');
TODO: {
local $TODO = "some kind of caching is still happening (it works if I remove the check above)";
- is($user_obj->Attributes->Named('Subscription'), 1, "we have a subscription");
+ is($user_obj->attributes->named('Subscription'), 1, "we have a subscription");
};
$m->get_ok("/Dashboards/Modify.html?id=$id");
@@ -163,12 +163,12 @@
$m->get_ok("/Dashboards/Modify.html?id=$id&Delete=1");
$m->content_contains("Permission denied", "unable to delete dashboard because we lack DeleteOwnDashboard");
-$user_obj->principal_object->grant_right(Right => 'DeleteOwnDashboard', Object => $RT::System);
+$user_obj->principal_object->grant_right(right => 'DeleteOwnDashboard', object => $RT::System);
$m->get_ok("/Dashboards/Modify.html?id=$id");
$m->content_contains('Delete', "Delete button shows because we have DeleteOwnDashboard");
-$m->form_name('modify_dashboard');
+$m->form_name( 'modify_dashboard' );
$m->click_button(name => 'Delete');
$m->content_contains("Deleted dashboard $id");
Modified: rt/branches/3.999-DANGEROUS/t/web/rest.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/rest.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/rest.t Fri Aug 22 23:39:15 2008
@@ -1,8 +1,8 @@
#!/usr/bin/env perl
use strict;
use warnings;
-use Test::More tests => 16;
use RT::Test;
+use Test::More tests => 16;
my ($baseurl, $m) = RT::Test->started_ok;
Modified: rt/branches/3.999-DANGEROUS/t/web/unlimited_search.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/unlimited_search.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/unlimited_search.t Fri Aug 22 23:39:15 2008
@@ -9,10 +9,10 @@
my $ticket = RT::Model::Ticket->new(current_user => RT->system_user);
for ( 1 .. 75 ) {
$ticket->create(
- Subject => 'Ticket ' . $_,
- Queue => 'General',
- Owner => 'root',
- Requestor => 'unlimitedsearch at localhost',
+ subject => 'Ticket ' . $_,
+ queue => 'General',
+ owner => 'root',
+ requestor => 'unlimitedsearch at localhost',
);
}
@@ -20,23 +20,23 @@
ok $agent->login('root', 'password'), 'logged in as root';
$agent->get_ok('/Search/Build.html');
-$agent->form_name('build_query');
-$agent->field('idOp', '>');
-$agent->field('ValueOfid', '0');
-$agent->submit('AddClause');
-$agent->form_name('build_query');
-$agent->field('RowsPerPage', '0');
-$agent->submit('DoSearch');
+$agent->form_name( 'build_query' );
+$agent->field('id_op', '>');
+$agent->field('value_of_id', '0');
+$agent->submit('add_clause');
+$agent->form_name( 'build_query' );
+$agent->field('rows_per_page', '0');
+$agent->submit('do_search');
$agent->follow_link_ok({text=>'Show Results'});
$agent->content_like(qr/Ticket 75/);
$agent->follow_link_ok({text=>'New Search'});
-$agent->form_name('build_query');
-$agent->field('idOp', '>');
-$agent->field('ValueOfid', '0');
-$agent->submit('AddClause');
-$agent->form_name('build_query');
-$agent->field('RowsPerPage', '50');
-$agent->submit('DoSearch');
+$agent->form_name( 'build_query' );
+$agent->field('id_op', '>');
+$agent->field('value_of_id', '0');
+$agent->submit('add_clause');
+$agent->form_name( 'build_query' );
+$agent->field('rows_per_page', '50');
+$agent->submit('do_search');
$agent->follow_link_ok({text=>'Bulk Update'});
$agent->content_unlike(qr/Ticket 51/);
More information about the Rt-commit
mailing list