Bugzilla – Attachment 76722 Details for
Bug 19915
Inventory tool doesn't use cn_sort for callnumber ranges
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t
Bug-19915-QA-follow-up-Tidy-up-GetItemsForInventor.patch (text/plain), 3.09 KB, created by
Marcel de Rooy
on 2018-07-06 10:12:34 UTC
(
hide
)
Description:
Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2018-07-06 10:12:34 UTC
Size:
3.09 KB
patch
obsolete
>From 7675f77289d866eb3f8a0b04034f5a0db8cba271 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 6 Jul 2018 11:20:47 +0200 >Subject: [PATCH] Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t >Content-Type: text/plain; charset=utf-8 > >Standard edits like modules, schema, Koha objects instead of DBIC. >Removing unneeded autoflush. >Moving initial test to a first subtest. >No need to clear issues if you clear items. >Adding a FIXME for OldWay; would be nice to remove that code.. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > t/db_dependent/Items/GetItemsForInventory.t | 55 +++++++++++++---------------- > 1 file changed, 24 insertions(+), 31 deletions(-) > >diff --git a/t/db_dependent/Items/GetItemsForInventory.t b/t/db_dependent/Items/GetItemsForInventory.t >index a09359a..a7a8e70 100755 >--- a/t/db_dependent/Items/GetItemsForInventory.t >+++ b/t/db_dependent/Items/GetItemsForInventory.t >@@ -18,43 +18,35 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >-use Test::More tests => 7; >+use Test::More tests => 2; >+ > use t::lib::TestBuilder; > >-use Koha::AuthorisedValues; >+use C4::Context; >+use C4::Biblio; > use C4::ClassSource; >+use C4::Items; >+use C4::Koha; >+use Koha::AuthorisedValues; >+use Koha::Database; >+use Koha::Items; > >-$| = 1; >- >-BEGIN { >- use_ok('C4::Context'); >- use_ok('C4::Items'); >- use_ok('C4::Biblio'); >- use_ok('C4::Koha'); >-} >- >-can_ok('C4::Items','GetItemsForInventory'); >- >-my $dbh = C4::Context->dbh; >-$dbh->{AutoCommit} = 0; >-$dbh->{RaiseError} = 1; >- >-my ($oldResults, $oldCount) = OldWay($dbh); >-my ($newResults, $newCount) = GetItemsForInventory; >+my $schema = Koha::Database->new->schema; >+$schema->storage->txn_begin; > >-is_deeply($newResults,$oldResults,"Inventory results unchanged."); >+subtest 'Verify results with OldWay' => sub { >+ plan tests => 1; > >-$dbh->rollback; >-$dbh->{AutoCommit} = 1; >+ my ($oldResults, $oldCount) = OldWay(); >+ my ($newResults, $newCount) = GetItemsForInventory(); >+ is_deeply($newResults,$oldResults,"Inventory results unchanged."); >+}; > > subtest 'Use cn_sort rather than callnumber to determine correct location' => sub { >- > plan tests => 1; >+ > my $builder = t::lib::TestBuilder->new; >- my $schema = Koha::Database->new->schema; >- $schema->storage->txn_begin; >- $builder->schema->resultset( 'Issue' )->delete_all; >- $builder->schema->resultset( 'Item' )->delete_all; >+ Koha::Items->delete; > > my $class_rule = $builder->build({ > source => 'ClassSortRule', >@@ -80,13 +72,14 @@ subtest 'Use cn_sort rather than callnumber to determine correct location' => su > class_source => $class_source->{cn_source}, > }); > is($item_count,1,"We should return GT95 as between GT90 and GT100"); >- $schema->storage->txn_rollback; > > }; > >-sub OldWay { >- my ($tdbh) = @_; >- my $ldbh = $tdbh; >+$schema->storage->txn_rollback; >+ >+sub OldWay { # FIXME Do we really still need so much code to check results ?? >+ my $ldbh = C4::Context->dbh; >+ > my $minlocation = ''; > my $maxlocation = ''; > my $location = ''; >-- >2.1.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 19915
:
70274
|
70275
|
70338
|
70339
|
72950
|
72951
|
72988
|
72989
|
76120
|
76721
|
76722
|
76723
|
76724
|
81816
|
81817
|
81818
|
81819
|
81820
|
81821
|
83644
|
83645
|
83646
|
83647
|
83648
|
83649
|
84665
|
84666
|
84667
|
84668
|
84669
|
84670