From 29a21d7d22ab572fea2affbf894b552eb765f0af Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Fri, 4 Oct 2024 11:27:50 -0300 Subject: [PATCH] Bug 38094: Regression tests Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Koha/Biblio.t | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 6af083b2762..25abfec30f9 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -1744,7 +1744,7 @@ subtest 'opac_summary_html' => sub { subtest 'can_be_edited() tests' => sub { - plan tests => 6; + plan tests => 8; $schema->storage->txn_begin; @@ -1772,6 +1772,24 @@ subtest 'can_be_edited() tests' => sub { ok( $biblio->can_be_edited($patron), "Patron with 'edit_catalogue' can edit" ); + my $fa_biblio = $builder->build_sample_biblio( { frameworkcode => 'FA' } ); + my $fa_patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); + + # Add editcatalogue => edit_catalog subpermission + $builder->build( + { + source => 'UserPermission', + value => { + borrowernumber => $fa_patron->id, + module_bit => 9, # editcatalogue + code => 'fast_cataloging', + }, + } + ); + + ok( !$biblio->can_be_edited($fa_patron), "Fast add permissions are not enough" ); + ok( $fa_biblio->can_be_edited($fa_patron), "Fast add user can edit FA records" ); + # Mock the record source doesn't allow direct editing $source_allows_editing = 0; ok( !$biblio->can_be_edited($patron), "Patron needs 'edit_locked_record' subpermission for locked records" ); -- 2.46.2