Bugzilla – Attachment 166867 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: Add unit test
Bug-35906-Add-unit-test.patch (text/plain), 2.14 KB, created by
Thibaud Guillot (thibaud_g)
on 2024-05-17 07:38:08 UTC
(
hide
)
Description:
Bug 35906: Add unit test
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2024-05-17 07:38:08 UTC
Size:
2.14 KB
patch
obsolete
>From 0789a2a2aacedb2c1ed7d7468bd44c8b18bf2641 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Fri, 23 Feb 2024 10:00:01 +0100 >Subject: [PATCH] Bug 35906: Add unit test > >--- > t/db_dependent/Koha/Items.t | 19 ++++++++++++++++++- > t/lib/TestBuilder.pm | 1 + > 2 files changed, 19 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Items.t b/t/db_dependent/Koha/Items.t >index ddf47a871aa..620da79ceee 100755 >--- a/t/db_dependent/Koha/Items.t >+++ b/t/db_dependent/Koha/Items.t >@@ -2078,7 +2078,7 @@ subtest 'filter_by_for_hold' => sub { > }; > > subtest 'filter_by_bookable' => sub { >- plan tests => 2; >+ plan tests => 3; > > $schema->storage->txn_begin; > >@@ -2097,5 +2097,22 @@ subtest 'filter_by_bookable' => sub { > "the correct item is returned from filter_by_bookable" > ); > >+ # unset level booking on item (for itemtype) >+ t::lib::Mocks::mock_preference( 'item-level_booking', 0 ); >+ >+ # test with itemtype directly bookable >+ my $item_type = $builder->build_object( { class => 'Koha::ItemTypes', value => { bookable => 1 } } ); >+ my $biblio2 = $builder->build_sample_biblio( { itemtype => $item_type->itemtype } ); >+ >+ # bookable items >+ my $bookable_item3 = $builder->build_sample_item( >+ { biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 1 } ); >+ my $bookable_item4 = $builder->build_sample_item( >+ { biblionumber => $biblio2->biblionumber, itype => $item_type->itemtype, bookable => 0 } ); >+ >+ # items are bookable even if bookable => 0 on item (due to itemtype bookable => 1) >+ is( $biblio2->items->filter_by_bookable->count, 2, "filter_by_bookable returns the correct number of items" ); >+ > $schema->storage->txn_rollback; >+ > }; >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 97d34c8d96d..35e4455b13c 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -633,6 +633,7 @@ sub _gen_default_values { > defaultreplacecost => 0, > processfee => 0, > notforloan => 0, >+ bookable => 0, > }, > Aqbookseller => { > tax_rate => 0, >-- >2.30.2
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