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