Bugzilla – Attachment 20505 Details for
Bug 10441
UT: Testing AddShare in VirtualShelves.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 10441: UT: Create patrons for Virtualshelves.t
Bug-10441-UT-Create-patrons-for-Virtualshelvest.patch (text/plain), 3.12 KB, created by
Jonathan Druart
on 2013-08-20 14:33:00 UTC
(
hide
)
Description:
Bug 10441: UT: Create patrons for Virtualshelves.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2013-08-20 14:33:00 UTC
Size:
3.12 KB
patch
obsolete
>From 4a87ce2772b08292daa77207fbb533082a7f1620 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@biblibre.com> >Date: Tue, 20 Aug 2013 16:31:33 +0200 >Subject: [PATCH] Bug 10441: UT: Create patrons for Virtualshelves.t > >Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> >--- > t/db_dependent/VirtualShelves.t | 32 ++++++++++++++++---------------- > 1 file changed, 16 insertions(+), 16 deletions(-) > >diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t >index c2865b2..507b0fd 100755 >--- a/t/db_dependent/VirtualShelves.t >+++ b/t/db_dependent/VirtualShelves.t >@@ -10,23 +10,23 @@ use MARC::Record; > > use C4::Biblio qw( AddBiblio DelBiblio ); > use C4::Context; >+use C4::Members qw( AddMember ); > > > my $dbh = C4::Context->dbh; > $dbh->{RaiseError} = 1; > $dbh->{AutoCommit} = 0; > >-# Getting some borrowers from database. >-my $query = q{SELECT borrowernumber FROM borrowers LIMIT 10}; >-my $borr_ref=$dbh->selectall_arrayref($query); >-if(@$borr_ref==0) { #no borrowers? should not occur of course >- $borr_ref->[0][0]=undef; >- #but even then, we can run this robust test :) >-} >-my @borrowers; >-foreach(1..10) { >- my $t= $_> @$borr_ref ? int(rand()*@$borr_ref): $_-1; #repeat if not enough >- push @borrowers, $borr_ref->[$t][0]; >+# Create some borrowers >+my @borrowernumbers; >+for my $i ( 1 .. 10 ) { >+ my $borrowernumber = AddMember( >+ firstname => 'my firstname', >+ surname => 'my surname ' . $i, >+ categorycode => 'S', >+ branchcode => 'CPL', >+ ); >+ push @borrowernumbers, $borrowernumber; > } > > # Creating some biblios >@@ -58,21 +58,21 @@ for my $i (0..9){ > shelfname => $name, > category => $catg, > }, >- $borrowers[$i]); >+ $borrowernumbers[$i]); > > if($ShelfNumber>-1) { > ok($ShelfNumber > -1, "created shelf"); # Shelf creation successful; > } > else { > my $t= C4::VirtualShelves::_CheckShelfName( >- $name, $catg, $borrowers[$i], 0); >+ $name, $catg, $borrowernumbers[$i], 0); > is($t, 0, "Name clash expected on shelf creation"); > } > push @shelves, { > number => $ShelfNumber, > name => $name, > catg => $catg, >- owner => $borrowers[$i], >+ owner => $borrowernumbers[$i], > }; #also push the errors > } > >@@ -89,7 +89,7 @@ for my $i (0..9){ > my $badNumShelf= AddShelf( { > shelfname=> $shelves[$i]->{name}, > category => 2 >- }, $borrowers[$i]); >+ }, $borrowernumbers[$i]); > is($badNumShelf, -1, 'do not create public lists with duplicate names'); > #AddShelf returns -1 if name already exist. > DelShelf($badNumShelf) if $badNumShelf>-1; #delete if went wrong.. >@@ -127,7 +127,7 @@ for my $i (0..9){ > #The different permissions could be tested too. > > my ($biblistBefore,$countbefore) = GetShelfContents($shelfnumber); >- my $status = AddToShelf($bib,$shelfnumber,$borrowers[$i]); >+ my $status = AddToShelf($bib,$shelfnumber,$borrowernumbers[$i]); > my ($biblistAfter,$countafter) = GetShelfContents($shelfnumber); > > if ($should_fail) { >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 10441
:
18822
|
19721
|
19736
|
19936
|
20505