Bugzilla – Attachment 152927 Details for
Bug 34152
Tests in t/db_dependent/Koha/Item.t fail
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34152: Fix failing t/db_dependent/Koha/Item.t tests
0001-Bug-34152-Fix-failing.patch (text/plain), 2.41 KB, created by
Emmi Takkinen
on 2023-07-03 11:52:38 UTC
(
hide
)
Description:
Bug 34152: Fix failing t/db_dependent/Koha/Item.t tests
Filename:
MIME Type:
Creator:
Emmi Takkinen
Created:
2023-07-03 11:52:38 UTC
Size:
2.41 KB
patch
obsolete
>From ed2794681f14ffe1916eda1743566bda548bbf33 Mon Sep 17 00:00:00 2001 >From: Emmi Takkinen <emmi.takkinen@koha-suomi.fi> >Date: Mon, 3 Jul 2023 14:50:19 +0300 >Subject: [PATCH] Bug 34152: Fix failing t/db_dependent/Koha/Item.t tests > >This patch fixes following issues in t/db_dependent/Koha/Item.t >tests: >- "Can't call method "can_edit_items_from" on an undefined value >at .../Koha/Item.pm line 298." with sending patron data to mocked >environment >- "holds tests" test failures due "not_same_branch" errors by mocking >IndependentBranches enabled and adding mock user environment > >To test: >1. Run prove t/db_dependent/Koha/Item.t. >=> Tests should fail. >2. Apply this patch. >3. Run prove t/db_dependent/Koha/Item.t again. >=> Success! > >Sponsored-by: Koha-Suomi Oy >--- > t/db_dependent/Koha/Item.t | 11 +++++++---- > 1 file changed, 7 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 66c4d16830..96c34fb191 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -849,9 +849,8 @@ subtest 'deletion' => sub { > > my $library = $builder->build_object({ class => 'Koha::Libraries' }); > my $library_2 = $builder->build_object({ class => 'Koha::Libraries' }); >- t::lib::Mocks::mock_userenv({ branchcode => $library->branchcode }); >- > my $patron = $builder->build_object({class => 'Koha::Patrons'}); >+ t::lib::Mocks::mock_userenv({ patron => $patron, branchcode => $library->branchcode }); > $item = $builder->build_sample_item({ library => $library->branchcode }); > > # book_on_loan >@@ -932,11 +931,15 @@ subtest 'deletion' => sub { > plan tests => 9; > > # to avoid noise >- t::lib::Mocks::mock_preference( 'IndependentBranches', 0 ); >+ t::lib::Mocks::mock_preference( 'IndependentBranches', 1 ); >+ >+ my $library = $builder->build_object({ class => 'Koha::Libraries' }); >+ my $patron = $builder->build_object({class => 'Koha::Patrons'}); >+ t::lib::Mocks::mock_userenv({ patron => $patron, branchcode => $library->branchcode }); > > $schema->storage->txn_begin; > >- my $item = $builder->build_sample_item; >+ my $item = $builder->build_sample_item({ library => $library->branchcode }); > > my $processing = $builder->build_object( { class => 'Koha::Holds', value => { itemnumber => $item->id, itemnumber => $item->id, found => 'P' } } ); > my $safe_to_delete = $item->safe_to_delete; >-- >2.34.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 34152
: 152927