Bugzilla – Attachment 166528 Details for
Bug 29087
Holds to pull list can crash with a SQL::Abstract puke
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29087: Add unit tests
Bug-29087-Add-unit-tests.patch (text/plain), 3.18 KB, created by
Matt Blenkinsop
on 2024-05-10 10:02:01 UTC
(
hide
)
Description:
Bug 29087: Add unit tests
Filename:
MIME Type:
Creator:
Matt Blenkinsop
Created:
2024-05-10 10:02:01 UTC
Size:
3.18 KB
patch
obsolete
>From b21fc990933e2e91afa2beaf31f9c3233dff5535 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Tue, 16 Apr 2024 12:47:16 +0000 >Subject: [PATCH] Bug 29087: Add unit tests > >prove t/db_dependent/Koha/Items.t > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/db_dependent/Koha/Items.t | 42 ++++++++++++++++++++++++++++++++----- > 1 file changed, 37 insertions(+), 5 deletions(-) > >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index ddf47a871a..7a8b35bfa9 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -1998,16 +1998,50 @@ subtest 'search_ordered' => sub { > > subtest 'filter_by_for_hold' => sub { > >- plan tests => 13; >+ plan tests => 15; > > $schema->storage->txn_begin; > >+ # Set default rule >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => undef, >+ itemtype => undef, >+ rule_name => 'holdallowed', >+ rule_value => 'not_allowed', >+ } >+ ); >+ my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); >+ my $not_holdable_itemtype = $itemtype->itemtype; >+ my $itemtype2 = $builder->build_object({ class => 'Koha::ItemTypes' }); >+ my $holdable_itemtype = $itemtype2->itemtype; >+ Koha::CirculationRules->set_rule( >+ { >+ branchcode => undef, >+ itemtype => $holdable_itemtype, >+ rule_name => 'holdallowed', >+ rule_value => 'from_any_library', >+ } >+ ); >+ > my $biblio = $builder->build_sample_biblio; > my $library = $builder->build_object({ class => 'Koha::Libraries' }); >- > t::lib::Mocks::mock_preference('IndependentBranches', 0); # more robust tests >- > is( $biblio->items->filter_by_for_hold->count, 0, 'no item yet' ); >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0, itype => $not_holdable_itemtype } ); >+ is( $biblio->items->filter_by_for_hold->count, 0, 'default rule prevents hold' ); >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0, itype => $holdable_itemtype } ); >+ is( $biblio->items->filter_by_for_hold->count, 1, 'hold allowed despite default rule' ); >+ >+ # Reset items and circ rules to remove default rule >+ $biblio->items->delete; >+ Koha::CirculationRules->search( >+ { >+ rule_name => 'holdallowed', >+ rule_value => 'not_allowed', >+ } >+ )->delete; >+ > $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 1 } ); > is( $biblio->items->filter_by_for_hold->count, 0, 'no item for hold' ); > $builder->build_sample_item( { biblionumber => $biblio->biblionumber, notforloan => 0 } ); >@@ -2030,8 +2064,6 @@ subtest 'filter_by_for_hold' => sub { > t::lib::Mocks::mock_preference('AllowHoldsOnDamagedItems', 1); > is( $biblio->items->filter_by_for_hold->count, 6, '6 items for hold - damaged if AllowHoldsOnDamagedItems' ); > >- my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); >- my $not_holdable_itemtype = $itemtype->itemtype; > $builder->build_sample_item( > { > biblionumber => $biblio->biblionumber, >-- >2.37.1 (Apple Git-137.1)
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 29087
:
127859
|
164936
|
166354
|
166355
|
166359
|
166360
|
166527
|
166528
|
168241
|
168242
|
169179
|
169180
|
169181