Browse Source

Bug 10565: (follow-up) don't assume borrowernumber 1 exists in unit test

Signed-off-by: Nora Blake <nblake@masslibsystem.org>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
new/bootstrap-opac
Kyle Hall 9 years ago
committed by Galen Charlton
parent
commit
b41d5d0e8a
  1. 18
      t/db_dependent/PatronLists.t

18
t/db_dependent/PatronLists.t

@ -14,19 +14,21 @@ my $sth = $dbh->prepare("SELECT * FROM borrowers ORDER BY RAND() LIMIT 10");
$sth->execute();
my @borrowers = @{ $sth->fetchall_arrayref( {} ) };
my @lists = GetPatronLists( { owner => 1 } );
my $owner = $borrowers[0]->{borrowernumber};
my @lists = GetPatronLists( { owner => $owner } );
my $list_count_original = @lists;
my $list1 = AddPatronList( { name => 'Test List 1', owner => 1 } );
my $list1 = AddPatronList( { name => 'Test List 1', owner => $owner } );
ok( $list1->name() eq 'Test List 1', 'AddPatronList works' );
my $list2 = AddPatronList( { name => 'Test List 2', owner => 1 } );
my $list2 = AddPatronList( { name => 'Test List 2', owner => $owner } );
ModPatronList(
{
patron_list_id => $list2->patron_list_id(),
name => 'Test List 3',
owner => 1
owner => $owner
}
);
$list2->discard_changes();
@ -64,12 +66,12 @@ DelPatronsFromList(
$list1->discard_changes();
ok( !$list1->patron_list_patrons()->count(), 'DelPatronsFromList works.' );
@lists = GetPatronLists( { owner => 1 } );
@lists = GetPatronLists( { owner => $owner } );
ok( @lists == $list_count_original + 2, 'GetPatronLists works' );
DelPatronList( { patron_list_id => $list1->patron_list_id(), owner => 1 } );
DelPatronList( { patron_list_id => $list2->patron_list_id(), owner => 1 } );
DelPatronList( { patron_list_id => $list1->patron_list_id(), owner => $owner } );
DelPatronList( { patron_list_id => $list2->patron_list_id(), owner => $owner } );
@lists =
GetPatronLists( { patron_list_id => $list1->patron_list_id(), owner => 1 } );
GetPatronLists( { patron_list_id => $list1->patron_list_id(), owner => $owner } );
ok( !@lists, 'DelPatronList works' );

Loading…
Cancel
Save