fix ticketing system error on bootstrap of new install
[freeside.git] / rt / t / api / bookmarks.t
1 use strict;
2 use warnings;
3 use RT::Test tests => 36;
4
5 my ( $url, $m ) = RT::Test->started_ok;
6 my $root = RT::Test->load_or_create_user( Name => 'root' );
7
8 my @tickets = RT::Test->create_tickets( { },  map { { Subject => "Test $_" } } ( 1 .. 9 ) );
9
10 # 4.2 gives us $user->ToggleBookmark which is nicer
11 $root->SetAttribute( Name => 'Bookmarks', Content => { map { $_ => 1 } (3,6,9) } );
12
13 my $cu = RT::CurrentUser->new($root);
14 my $bookmarks = RT::Tickets->new($cu);
15 for my $search ( "Queue = 'General' AND id = '__Bookmarked__'",
16                  "id = '__Bookmarked__' AND Queue = 'General'",
17                  "id > 0 AND id = '__Bookmarked__'",
18                  "id = '__Bookmarked__' AND id > 0",
19                  "id = 3 OR id = '__Bookmarked__'",
20                  "id = '__Bookmarked__' OR id = 3",
21              ) {
22     $bookmarks->FromSQL($search);
23     is($bookmarks->Count,3,"Found my 3 bookmarks for [$search]");
24 }