Browse Source

Bug 23281: Implement ->search_with_library_limits in Koha::Patron::Attribute::Types

This patch makes Koha::Patron::Attribute::Types inherit from
Koha::Objects::Limit::Library so it now has the
->search_with_library_limits method.

Tests are adjusted so it is clear that there is no behaviour change
compared to the (previsouly) called ->search

To test:
- Run:
 k$ prove t/db_dependent/Koha/Patron/Attribute/Types.t
=> SUCCESS: Tests pass!
- Apply this patch
- Run:
 k$ prove t/db_dependent/Koha/Patron/Attribute/Types.t
=> SUCCESS: Tests still pass!
- Sign off :-D

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
remotes/origin/19.11.x
Tomás Cohen Arazi 5 years ago
committed by Martin Renvoize
parent
commit
90b48c2c48
Signed by: martin.renvoize GPG Key ID: 422B469130441A0F
  1. 2
      Koha/Patron/Attribute/Types.pm
  2. 16
      t/db_dependent/Koha/Patron/Attribute/Types.t

2
Koha/Patron/Attribute/Types.pm

@ -19,7 +19,7 @@ use Modern::Perl;
use Koha::Patron::Attribute::Type;
use base qw(Koha::Objects);
use base qw(Koha::Objects Koha::Objects::Limit::Library);
=head1 NAME

16
t/db_dependent/Koha/Patron/Attribute/Types.t

@ -287,7 +287,7 @@ subtest 'replace_library_limits() tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'search() with branch limits tests' => sub {
subtest 'search_with_library_limits() tests' => sub {
plan tests => 3;
@ -322,16 +322,10 @@ subtest 'search() with branch limits tests' => sub {
$object_code_2->library_limits( [$branch_2] );
$object_code_3->library_limits( [ $branch_1, $branch_2 ] );
is( Koha::Patron::Attribute::Types->search( { branchcode => $branch_1 } )
->count,
3,
'3 attribute types are available for the specified branch'
);
is( Koha::Patron::Attribute::Types->search( { branchcode => $branch_2 } )
->count,
3,
'3 attribute types are available for the specified branch'
);
is( Koha::Patron::Attribute::Types->search_with_library_limits( {}, {}, $branch_1 )->count,
3, '3 attribute types are available for the specified branch' );
is( Koha::Patron::Attribute::Types->search_with_library_limits( {}, {}, $branch_2 )->count,
3, '3 attribute types are available for the specified branch' );
$schema->storage->txn_rollback;
};

Loading…
Cancel
Save