Bug 19915: (QA follow-up) Tidy up GetItemsForInventory.t

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>

https://bugs.koha-community.org/show_bug.cgi?id=19905

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit c345d30cc8)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2018-07-06 11:20:47 +02:00 committed by Martin Renvoize
parent 567c0df6ee
commit 39acd694ca
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
1 changed files with 18 additions and 14 deletions

View File

@ -60,7 +60,6 @@ subtest 'Old version is unchanged' => sub {
$schema->storage->txn_rollback;
};
<<<<<<< HEAD
subtest 'Skip items with waiting holds' => sub {
plan tests => 6;
@ -127,18 +126,24 @@ subtest 'Skip items with waiting holds' => sub {
'Item on hold skipped, no one matches' );
$schema->storage->txn_rollback;
=======
$dbh->rollback;
$dbh->{AutoCommit} = 1;
};
subtest 'Verify results with OldWay' => sub {
$schema->storage->txn_begin;
plan tests => 1;
my ($oldResults, $oldCount) = OldWay();
my ($newResults, $newCount) = GetItemsForInventory();
is_deeply($newResults,$oldResults,"Inventory results unchanged.");
$schema->storage->txn_rollback;
};
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;
plan tests => 1;
my $builder = t::lib::TestBuilder->new;
Koha::Items->delete;
my $class_rule = $builder->build({
source => 'ClassSortRule',
@ -166,12 +171,11 @@ subtest 'Use cn_sort rather than callnumber to determine correct location' => su
is($item_count,1,"We should return GT95 as between GT90 and GT100");
$schema->storage->txn_rollback;
>>>>>>> Bug 19915: Add unit test to GetItemsForInventory.t
};
sub OldWay {
my ($tdbh) = @_;
my $ldbh = $tdbh;
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 = '';