Bug 38094: Regression tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
This commit is contained in:
Tomas Cohen Arazi 2024-10-04 11:27:50 -03:00 committed by Katrin Fischer
parent 20c38762b8
commit 4623dce6f7
No known key found for this signature in database
GPG Key ID: 0EF6E2C03357A834
1 changed files with 19 additions and 1 deletions

View File

@ -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" );