Bugzilla – Attachment 19619 Details for
Bug 10499
UT: VirtualShelves.t needs a database transaction
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[PASSED QA] Bug 10499: VirtualShelves.t - wrap tests in a database connection
PASSED-QA-Bug-10499-VirtualShelvest---wrap-tests-i.patch (text/plain), 3.49 KB, created by
Katrin Fischer
on 2013-07-14 07:37:24 UTC
(
hide
)
Description:
[PASSED QA] Bug 10499: VirtualShelves.t - wrap tests in a database connection
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2013-07-14 07:37:24 UTC
Size:
3.49 KB
patch
obsolete
>From 0937b7b3c60196d9aef67ecf778158b7630f82c0 Mon Sep 17 00:00:00 2001 >From: Kenza Zaki <kenza.zaki@biblibre.com> >Date: Mon, 1 Jul 2013 10:48:03 +0200 >Subject: [PATCH] [PASSED QA] Bug 10499: VirtualShelves.t - wrap tests in a > database connection > >Before this patch, the queries in VirtualShelves.t were committed in the >database and have to be removed at the end. >This patch wraps tests in a database connection. > >Test plan: >prove t/db_dependent/VirtualShelves.t >VirtualShelves.t .. ok >All tests successful. >Files=1, Tests=72, 1 wallclock secs ( 0.06 usr 0.00 sys + 0.72 cusr 0.06 csys = 0.84 CPU) >Result: PASS > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> >All tests pass. >--- > t/db_dependent/VirtualShelves.t | 35 ++++++++++++----------------------- > 1 file changed, 12 insertions(+), 23 deletions(-) > >diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t >index 563eeca..9f3f1b0 100755 >--- a/t/db_dependent/VirtualShelves.t >+++ b/t/db_dependent/VirtualShelves.t >@@ -5,14 +5,18 @@ > # Larger modifications by Jonathan Druart and Marcel de Rooy > > use Modern::Perl; >-use Test::More tests => 81; >+use Test::More tests => 71; > use MARC::Record; > > use C4::Biblio qw( AddBiblio DelBiblio ); > use C4::Context; > >-# Getting some borrowers from database. >+ > 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 >@@ -46,7 +50,7 @@ use_ok('C4::VirtualShelves'); > > # creating shelves (could be <10 when names are not unique) > my @shelves; >-for(my $i=0; $i<10;$i++) { >+for my $i(0..9){ > my $name= randomname(); > my $catg= int(rand(2))+1; > my $ShelfNumber= AddShelf( >@@ -73,7 +77,7 @@ for(my $i=0; $i<10;$i++) { > } > > # try to create shelves with duplicate names >-for(my $i=0;$i<10;$i++){ >+for my $i(0..9){ > if($shelves[$i]->{number}<0) { > ok(1, 'skip duplicate test for earlier name clash'); > next; >@@ -108,7 +112,7 @@ for(my $i=0;$i<10;$i++){ > # usage : $biblist = GetShelfContents($shelfnumber); > > my %used = (); >-for(my $i=0; $i<10;$i++){ >+for my $i(0..9){ > my $bib = $biblionumbers[int(rand(9))]; > my $shelfnumber = $shelves[int(rand(9))]->{number}; > if($shelfnumber<0) { >@@ -145,7 +149,7 @@ for(my $i=0; $i<10;$i++){ > # usage : ModShelf($shelfnumber, $shelfname, $owner, $category ) > # usage : (shelfnumber,shelfname,owner,category) = GetShelf($shelfnumber); > >-for(my $i=0; $i<10;$i++){ >+for my $i(0..9){ > my $rand = int(rand(9)); > my $numA = $shelves[$rand]->{number}; > if($numA<0) { >@@ -173,23 +177,6 @@ for(my $i=0; $i<10;$i++){ > } > } > >-#-----------------------TEST DelShelf & DelFromShelf functions------------------------# >-# usage : ($status) = &DelShelf($shelfnumber); >- >-for(my $i=0; $i<10;$i++){ >- my $shelfnumber = $shelves[$i]->{number}; >- if($shelfnumber<0) { >- ok(1, 'Skip DelShelf for shelf -1'); >- next; >- } >- my $status = DelShelf($shelfnumber); >- ok(1 == $status, "deleted shelf $shelfnumber and its contents"); >-} >- >-#----------------------- CLEANUP ----------------------------------------------# >- >-DelBiblio($_) for @biblionumbers; >- > #----------------------- SOME SUBS --------------------------------------------# > > sub randomname { >@@ -199,3 +186,5 @@ sub randomname { > } > return $rv; > } >+ >+$dbh->rollback; >-- >1.7.9.5
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 10499
:
19171
|
19221
|
19308
|
19343
| 19619