|
Lines 14-32
my $sth = $dbh->prepare("SELECT * FROM borrowers ORDER BY RAND() LIMIT 10");
Link Here
|
| 14 |
$sth->execute(); |
14 |
$sth->execute(); |
| 15 |
my @borrowers = @{ $sth->fetchall_arrayref( {} ) }; |
15 |
my @borrowers = @{ $sth->fetchall_arrayref( {} ) }; |
| 16 |
|
16 |
|
| 17 |
my @lists = GetPatronLists( { owner => 1 } ); |
17 |
my $owner = $borrowers[0]->{borrowernumber}; |
|
|
18 |
|
| 19 |
my @lists = GetPatronLists( { owner => $owner } ); |
| 18 |
my $list_count_original = @lists; |
20 |
my $list_count_original = @lists; |
| 19 |
|
21 |
|
| 20 |
my $list1 = AddPatronList( { name => 'Test List 1', owner => 1 } ); |
22 |
my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } ); |
| 21 |
ok( $list1->name() eq 'Test List 1', 'AddPatronList works' ); |
23 |
ok( $list1->name() eq 'Test List 1', 'AddPatronList works' ); |
| 22 |
|
24 |
|
| 23 |
my $list2 = AddPatronList( { name => 'Test List 2', owner => 1 } ); |
25 |
my $list2 = AddPatronList( { name => 'Test List 2', owner => $owner } ); |
| 24 |
|
26 |
|
| 25 |
ModPatronList( |
27 |
ModPatronList( |
| 26 |
{ |
28 |
{ |
| 27 |
patron_list_id => $list2->patron_list_id(), |
29 |
patron_list_id => $list2->patron_list_id(), |
| 28 |
name => 'Test List 3', |
30 |
name => 'Test List 3', |
| 29 |
owner => 1 |
31 |
owner => $owner |
| 30 |
} |
32 |
} |
| 31 |
); |
33 |
); |
| 32 |
$list2->discard_changes(); |
34 |
$list2->discard_changes(); |
|
Lines 64-75
DelPatronsFromList(
Link Here
|
| 64 |
$list1->discard_changes(); |
66 |
$list1->discard_changes(); |
| 65 |
ok( !$list1->patron_list_patrons()->count(), 'DelPatronsFromList works.' ); |
67 |
ok( !$list1->patron_list_patrons()->count(), 'DelPatronsFromList works.' ); |
| 66 |
|
68 |
|
| 67 |
@lists = GetPatronLists( { owner => 1 } ); |
69 |
@lists = GetPatronLists( { owner => $owner } ); |
| 68 |
ok( @lists == $list_count_original + 2, 'GetPatronLists works' ); |
70 |
ok( @lists == $list_count_original + 2, 'GetPatronLists works' ); |
| 69 |
|
71 |
|
| 70 |
DelPatronList( { patron_list_id => $list1->patron_list_id(), owner => 1 } ); |
72 |
DelPatronList( { patron_list_id => $list1->patron_list_id(), owner => $owner } ); |
| 71 |
DelPatronList( { patron_list_id => $list2->patron_list_id(), owner => 1 } ); |
73 |
DelPatronList( { patron_list_id => $list2->patron_list_id(), owner => $owner } ); |
| 72 |
|
74 |
|
| 73 |
@lists = |
75 |
@lists = |
| 74 |
GetPatronLists( { patron_list_id => $list1->patron_list_id(), owner => 1 } ); |
76 |
GetPatronLists( { patron_list_id => $list1->patron_list_id(), owner => $owner } ); |
| 75 |
ok( !@lists, 'DelPatronList works' ); |
77 |
ok( !@lists, 'DelPatronList works' ); |
| 76 |
- |
|
|