From cf3e36636312f4dc8fc1b631335b7687646ad348 Mon Sep 17 00:00:00 2001 From: Brendan Lawlor Date: Wed, 22 Jan 2025 18:33:58 +0000 Subject: [PATCH] Bug 32773: (follow-up) Unit tests --- t/db_dependent/Koha/Biblio.t | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 0576acca56..74c96cbda9 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -34,6 +34,7 @@ use Koha::AuthorisedValueCategories; use Koha::AuthorisedValues; use Koha::MarcSubfieldStructures; use Koha::Exception; +use Koha::BiblioFrameworks; use MARC::Field; use MARC::Record; @@ -1765,7 +1766,7 @@ subtest 'opac_summary_html' => sub { subtest 'can_be_edited() tests' => sub { - plan tests => 9; + plan tests => 11; $schema->storage->txn_begin; @@ -1796,6 +1797,10 @@ subtest 'can_be_edited() tests' => sub { my $fa_biblio = $builder->build_sample_biblio( { frameworkcode => 'FA' } ); my $fa_patron = $builder->build_object( { class => 'Koha::Patrons', value => { flags => 0 } } ); + my $is_fa_framework = + $builder->build_object( { class => 'Koha::BiblioFrameworks', value => { is_fast_add => 1 } } ); + my $is_fa_biblio = $builder->build_sample_biblio( { frameworkcode => $is_fa_framework->frameworkcode } ); + # Add editcatalogue => edit_catalog subpermission $builder->build( { @@ -1808,9 +1813,11 @@ subtest 'can_be_edited() tests' => sub { } ); - 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" ); - ok( $fa_biblio->can_be_edited($patron), "edit_catalogue user can edit FA records" ); + 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" ); + ok( $fa_biblio->can_be_edited($patron), "edit_catalogue user can edit FA records" ); + ok( $is_fa_biblio->can_be_edited($fa_patron), "Fast add user can edit is_fast_add records" ); + ok( $is_fa_biblio->can_be_edited($patron), "edit_catalogue user can edit is_fast_add records" ); # Mock the record source doesn't allow direct editing $source_allows_editing = 0; -- 2.39.5