Bugzilla – Attachment 19936 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: QA Followup for Virtualshelves.t
Bug-10441-QA-Followup-for-Virtualshelvest.patch (text/plain), 5.33 KB, created by
Marcel de Rooy
on 2013-07-25 07:43:29 UTC
(
hide
)
Description:
Bug 10441: QA Followup for Virtualshelves.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2013-07-25 07:43:29 UTC
Size:
5.33 KB
patch
obsolete
>From ab34bb356a47fa35f117331dff58e17031026040 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Thu, 25 Jul 2013 09:33:44 +0200 >Subject: [PATCH] Bug 10441: QA Followup for Virtualshelves.t >Content-Type: text/plain; charset=utf-8 > >As requested by Jonathan: >Replace a i++ construct by 0..9; added a space to similar constructs. >Change ok-calls by is-calls where applicable. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >83 tests still pass, no complaints from koha-qa. >--- > t/db_dependent/VirtualShelves.t | 32 ++++++++++++++++---------------- > 1 files changed, 16 insertions(+), 16 deletions(-) > >diff --git a/t/db_dependent/VirtualShelves.t b/t/db_dependent/VirtualShelves.t >index 4a20619..c2865b2 100755 >--- a/t/db_dependent/VirtualShelves.t >+++ b/t/db_dependent/VirtualShelves.t >@@ -50,7 +50,7 @@ use_ok('C4::VirtualShelves'); > > # creating shelves (could be <10 when names are not unique) > my @shelves; >-for my $i(0..9){ >+for my $i (0..9){ > my $name= randomname(); > my $catg= int(rand(2))+1; > my $ShelfNumber= AddShelf( >@@ -66,7 +66,7 @@ for my $i(0..9){ > else { > my $t= C4::VirtualShelves::_CheckShelfName( > $name, $catg, $borrowers[$i], 0); >- ok($t==0, "Name clash expected on shelf creation"); >+ is($t, 0, "Name clash expected on shelf creation"); > } > push @shelves, { > number => $ShelfNumber, >@@ -77,7 +77,7 @@ for my $i(0..9){ > } > > # try to create shelves with duplicate names >-for my $i(0..9){ >+for my $i (0..9){ > if($shelves[$i]->{number}<0) { > ok(1, 'skip duplicate test for earlier name clash'); > next; >@@ -90,7 +90,7 @@ for my $i(0..9){ > shelfname=> $shelves[$i]->{name}, > category => 2 > }, $borrowers[$i]); >- ok(-1==$badNumShelf, 'do not create public lists with duplicate names'); >+ 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.. > } >@@ -101,7 +101,7 @@ for my $i(0..9){ > category => 1, > }, > $shlf[2]): -1; >- ok(-1==$badNumShelf, 'do not create private lists with duplicate name for same user'); >+ is($badNumShelf, -1, 'do not create private lists with duplicate name for same user'); > DelShelf($badNumShelf) if $badNumShelf>-1; #delete if went wrong.. > } > } >@@ -112,7 +112,7 @@ for my $i(0..9){ > # usage : $biblist = GetShelfContents($shelfnumber); > > my %used = (); >-for my $i(0..9){ >+for my $i (0..9){ > my $bib = $biblionumbers[int(rand(9))]; > my $shelfnumber = $shelves[int(rand(9))]->{number}; > if($shelfnumber<0) { >@@ -137,9 +137,9 @@ for my $i(0..9){ > } > > if (defined $status) { >- ok($countbefore == $countafter - 1, 'added bib to list'); # the bib has been successfuly added. >+ is($countbefore, $countafter - 1, 'added bib to list'); # the bib has been successfuly added. > } else { >- ok($countbefore == $countafter, 'did not add duplicate bib to list'); >+ is($countbefore, $countafter, 'did not add duplicate bib to list'); > } > > $used{$key}++; >@@ -149,7 +149,7 @@ for my $i(0..9){ > # usage : ModShelf($shelfnumber, $shelfname, $owner, $category ) > # usage : (shelfnumber,shelfname,owner,category) = GetShelf($shelfnumber); > >-for my $i(0..9){ >+for my $i (0..9){ > my $rand = int(rand(9)); > my $numA = $shelves[$rand]->{number}; > if($numA<0) { >@@ -168,9 +168,9 @@ for my $i(0..9){ > $shelves[$rand]->{owner}, $numA)) { > ModShelf($numA,$shelf); > my ($numB,$nameB,$ownerB,$categoryB) = GetShelf($numA); >- ok($numA == $numB, 'modified shelf'); >- ok($shelf->{shelfname} eq $nameB, '... and name change took'); >- ok($shelf->{category} eq $categoryB, '... and category change took'); >+ is($numA, $numB, 'modified shelf'); >+ is($shelf->{shelfname}, $nameB, '... and name change took'); >+ is($shelf->{category}, $categoryB, '... and category change took'); > } > else { > ok(1, "No ModShelf for $newname") for 1..3; >@@ -187,7 +187,7 @@ my $cnt1=$dbh->selectrow_array($sql_sharecount); > #try to add a share without shelfnumber: should fail > AddShare(0, 'abcdefghij'); > my $cnt2=$dbh->selectrow_array($sql_sharecount); >-ok($cnt1 == $cnt2, "Did not add an invalid share record"); >+is($cnt1,$cnt2, "Did not add an invalid share record"); > > #add another share: should be okay > #AddShare assumes that you tested if category==private (so we could actually >@@ -199,19 +199,19 @@ if($n<0) { > else { > AddShare($n, 'abcdefghij'); > my $cnt3=$dbh->selectrow_array($sql_sharecount); >- ok(1+$cnt2 == $cnt3, "Added one new share record with invitekey"); >+ is(1+$cnt2, $cnt3, "Added one new share record with invitekey"); > } > > #----------------TEST DelShelf & DelFromShelf functions------------------------# > >-for(my $i=0; $i<10;$i++){ >+for my $i (0..9){ > 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"); >+ is($status, 1, "deleted shelf $shelfnumber and its contents"); > } > > #----------------------- SOME SUBS --------------------------------------------# >-- >1.7.7.6
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