Bugzilla – Attachment 172961 Details for
Bug 35906
Add bookable option on itemtypes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35906: (QA follow-up) Unit tests for effective_bookable
Bug-35906-QA-follow-up-Unit-tests-for-effectiveboo.patch (text/plain), 2.77 KB, created by
Paul Derscheid
on 2024-10-18 10:59:45 UTC
(
hide
)
Description:
Bug 35906: (QA follow-up) Unit tests for effective_bookable
Filename:
MIME Type:
Creator:
Paul Derscheid
Created:
2024-10-18 10:59:45 UTC
Size:
2.77 KB
patch
obsolete
>From 39902985822a1d35a7c50b3660c10acc891b0817 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 18 Oct 2024 11:40:45 +0100 >Subject: [PATCH] Bug 35906: (QA follow-up) Unit tests for effective_bookable > >Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de> >--- > t/db_dependent/Koha/Item.t | 58 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 57 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 9fa642be69..22eebc3664 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 37; >+use Test::More tests => 38; > use Test::Exception; > use Test::MockModule; > >@@ -3175,3 +3175,59 @@ subtest 'effective_not_for_loan_status() tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'effective_bookable() tests' => sub { >+ >+ plan tests => 5; >+ >+ $schema->storage->txn_begin; >+ >+ my $biblio = $builder->build_sample_biblio; >+ my $biblio_itype = Koha::ItemTypes->find( $biblio->itemtype ); >+ $biblio_itype->bookable(0)->store(); >+ $biblio_itype->discard_changes; >+ >+ my $item_itype = $builder->build_object( { class => 'Koha::ItemTypes' } ); >+ $item_itype->bookable(1)->store(); >+ $item_itype->discard_changes; >+ >+ my $item = $builder->build_sample_item( { biblionumber => $biblio->biblionumber, itype => $item_itype->itemtype } ); >+ $item->bookable(undef)->store(); >+ $item->discard_changes; >+ >+ isnt( $biblio->itemtype, $item_itype->itemtype, "Biblio level itemtype and item level itemtype does not match" ); >+ >+ t::lib::Mocks::mock_preference( 'item-level_itypes', 0 ); >+ note("item-level_itypes: 0"); >+ >+ is( >+ $item->effective_bookable, $biblio_itype->bookable, >+ '->effective_bookable returns biblio level itemtype bookable value when item bookable is undefined' >+ ); >+ >+ $item->bookable(1)->store(); >+ $item->discard_changes; >+ isnt( >+ $item->effective_bookable, $biblio_itype->bookable, >+ '->effective_bookable returns item specific bookable value when item bookable is defined' >+ ); >+ >+ t::lib::Mocks::mock_preference( 'item-level_itypes', 1 ); >+ note("item-level_itypes: 1"); >+ >+ $item->bookable(undef)->store(); >+ $item->discard_changes; >+ is( >+ $item->effective_bookable, $item_itype->bookable, >+ '->effective_bookable returns item level itemtype bookable value when item bookable is undefined' >+ ); >+ >+ $item->bookable(0)->store(); >+ $item->discard_changes; >+ isnt( >+ $item->effective_bookable, $item_itype->bookable, >+ '->effective_bookable returns item specific bookable value when item bookable is defined' >+ ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.47.0
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 35906
:
161397
|
161638
|
161744
|
161961
|
162242
|
162365
|
162465
|
162466
|
162467
|
162468
|
162469
|
162470
|
162472
|
163291
|
163292
|
163293
|
163294
|
163295
|
163547
|
163548
|
163549
|
163550
|
163551
|
164579
|
164580
|
164581
|
164582
|
164583
|
164584
|
164585
|
165437
|
166866
|
166867
|
166868
|
166869
|
166870
|
166871
|
168120
|
168121
|
168122
|
168160
|
168161
|
168162
|
168163
|
168164
|
170187
|
170188
|
170189
|
170190
|
170191
|
170582
|
170583
|
170584
|
170585
|
170586
|
172127
|
172128
|
172129
|
172130
|
172131
|
172132
|
172941
|
172945
|
172950
|
172951
|
172952
|
172953
|
172954
|
172955
|
172956
|
172957
|
172958
|
172959
|
172960
|
172961
|
173324
|
173325
|
173326
|
173327
|
173328
|
173329
|
173330
|
173331
|
173332
|
173333
|
173334
|
173335
|
173893