summaryrefslogtreecommitdiff
path: root/rt/t/api/searchbuilder.t
diff options
context:
space:
mode:
authorivan <ivan>2009-12-31 13:16:41 +0000
committerivan <ivan>2009-12-31 13:16:41 +0000
commit63a268637b2d51a8766412617724b9436439deb6 (patch)
treea50f6d4c7829d5c80905e989144317192a44dc90 /rt/t/api/searchbuilder.t
parent65a561e3cd8c1ba94f6282f5d2a1cd9783afbd21 (diff)
parentb4b0c7e72d7eaee2fbfc7022022c9698323203dd (diff)
This commit was generated by cvs2svn to compensate for changes in r8690,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/t/api/searchbuilder.t')
-rw-r--r--rt/t/api/searchbuilder.t40
1 files changed, 40 insertions, 0 deletions
diff --git a/rt/t/api/searchbuilder.t b/rt/t/api/searchbuilder.t
new file mode 100644
index 000000000..cb118906c
--- /dev/null
+++ b/rt/t/api/searchbuilder.t
@@ -0,0 +1,40 @@
+
+use strict;
+use warnings;
+use RT;
+use RT::Test tests => 11;
+
+
+{
+
+ok (require RT::SearchBuilder);
+
+
+}
+
+{
+
+use_ok('RT::Queues');
+ok(my $queues = RT::Queues->new($RT::SystemUser), 'Created a queues object');
+ok( $queues->UnLimit(),'Unlimited the result set of the queues object');
+my $items = $queues->ItemsArrayRef();
+my @items = @{$items};
+
+ok($queues->NewItem->_Accessible('Name','read'));
+my @sorted = sort {lc($a->Name) cmp lc($b->Name)} @items;
+ok (@sorted, "We have an array of queues, sorted". join(',',map {$_->Name} @sorted));
+
+ok (@items, "We have an array of queues, raw". join(',',map {$_->Name} @items));
+my @sorted_ids = map {$_->id } @sorted;
+my @items_ids = map {$_->id } @items;
+
+is ($#sorted, $#items);
+is ($sorted[0]->Name, $items[0]->Name);
+is ($sorted[-1]->Name, $items[-1]->Name);
+is_deeply(\@items_ids, \@sorted_ids, "ItemsArrayRef sorts alphabetically by name");
+
+
+
+}
+
+1;