Lines 221-227
subtest 'search_limited' => sub {
Link Here
|
221 |
}; |
221 |
}; |
222 |
|
222 |
|
223 |
subtest 'may_article_request' => sub { |
223 |
subtest 'may_article_request' => sub { |
224 |
plan tests => 6; |
224 |
plan tests => 3; |
225 |
|
225 |
|
226 |
# mocking |
226 |
# mocking |
227 |
t::lib::Mocks::mock_preference('ArticleRequests', 1); |
227 |
t::lib::Mocks::mock_preference('ArticleRequests', 1); |
Lines 231-248
subtest 'may_article_request' => sub {
Link Here
|
231 |
'PT' => { 'BK' => 1 }, |
231 |
'PT' => { 'BK' => 1 }, |
232 |
}); |
232 |
}); |
233 |
|
233 |
|
234 |
# tests for class method call |
234 |
my $itemtype = Koha::ItemTypes->find('CR') // Koha::ItemType->new({ itemtype => 'CR' })->store; |
235 |
is( Koha::Biblio->may_article_request({ itemtype => 'CR' }), 1, 'SER/* should be true' ); |
235 |
is( $itemtype->may_article_request, 1, 'SER/* should be true' ); |
236 |
is( Koha::Biblio->may_article_request({ itemtype => 'CR', categorycode => 'S' }), 1, 'SER/S should be true' ); |
236 |
is( $itemtype->may_article_request({ categorycode => 'S' }), 1, 'SER/S should be true' ); |
237 |
is( Koha::Biblio->may_article_request({ itemtype => 'CR', categorycode => 'PT' }), '', 'SER/PT should be false' ); |
237 |
is( $itemtype->may_article_request({ categorycode => 'PT' }), '', 'SER/PT should be false' ); |
238 |
|
|
|
239 |
# tests for instance method call |
240 |
my $builder = t::lib::TestBuilder->new; |
241 |
my $biblio = $builder->build_object({ class => 'Koha::Biblios' }); |
242 |
my $biblioitem = $builder->build_object({ class => 'Koha::Biblioitems', value => { biblionumber => $biblio->biblionumber, itemtype => 'BK' }}); |
243 |
is( $biblio->may_article_request, '', 'BK/* false' ); |
244 |
is( $biblio->may_article_request({ categorycode => 'S' }), 1, 'BK/S true' ); |
245 |
is( $biblio->may_article_request({ categorycode => 'PT' }), 1, 'BK/PT true' ); |
246 |
|
238 |
|
247 |
# Cleanup |
239 |
# Cleanup |
248 |
$cache->clear_from_cache( Koha::IssuingRules::GUESSED_ITEMTYPES_KEY ); |
240 |
$cache->clear_from_cache( Koha::IssuingRules::GUESSED_ITEMTYPES_KEY ); |
249 |
- |
|
|