|
Lines 49-74
my $inheritCatCode = $builder->build(
Link Here
|
| 49 |
} |
49 |
} |
| 50 |
); |
50 |
); |
| 51 |
|
51 |
|
| 52 |
my $yesItypeCode = $builder->build_object({ |
52 |
my $yesItypeCode = $builder->build_object( |
| 53 |
class => 'Koha::ItemTypes', |
53 |
{ |
| 54 |
value => { |
54 |
class => 'Koha::ItemTypes', |
| 55 |
checkprevcheckout => 'yes', |
55 |
value => { |
|
|
56 |
checkprevcheckout => 'yes', |
| 57 |
} |
| 56 |
} |
58 |
} |
| 57 |
}); |
59 |
); |
| 58 |
|
60 |
|
| 59 |
my $noItypeCode = $builder->build_object({ |
61 |
my $noItypeCode = $builder->build_object( |
| 60 |
class => 'Koha::ItemTypes', |
62 |
{ |
| 61 |
value => { |
63 |
class => 'Koha::ItemTypes', |
| 62 |
checkprevcheckout => 'no', |
64 |
value => { |
|
|
65 |
checkprevcheckout => 'no', |
| 66 |
} |
| 63 |
} |
67 |
} |
| 64 |
}); |
68 |
); |
| 65 |
|
69 |
|
| 66 |
my $inheritItypeCode = $builder->build_object({ |
70 |
my $inheritItypeCode = $builder->build_object( |
| 67 |
class => 'Koha::ItemTypes', |
71 |
{ |
| 68 |
value => { |
72 |
class => 'Koha::ItemTypes', |
| 69 |
checkprevcheckout => 'inherit', |
73 |
value => { |
|
|
74 |
checkprevcheckout => 'inherit', |
| 75 |
} |
| 70 |
} |
76 |
} |
| 71 |
}); |
77 |
); |
| 72 |
|
78 |
|
| 73 |
# Create context for some tests late on in the file. |
79 |
# Create context for some tests late on in the file. |
| 74 |
my $library = $builder->build( { source => 'Branch' } ); |
80 |
my $library = $builder->build( { source => 'Branch' } ); |
|
Lines 235-241
map {
Link Here
|
| 235 |
} @{ $_->{categories} }; |
241 |
} @{ $_->{categories} }; |
| 236 |
} @{$mappings}; |
242 |
} @{$mappings}; |
| 237 |
|
243 |
|
| 238 |
|
|
|
| 239 |
# wants_check_for_previous_checkout |
244 |
# wants_check_for_previous_checkout |
| 240 |
|
245 |
|
| 241 |
# We want to test the subroutine by passing the $item parameter |
246 |
# We want to test the subroutine by passing the $item parameter |
|
Lines 288-316
map {
Link Here
|
| 288 |
# | Expected Result | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
293 |
# | Expected Result | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
| 289 |
|
294 |
|
| 290 |
my $itypeCode = { |
295 |
my $itypeCode = { |
| 291 |
'yes' => $yesItypeCode->itemtype, |
296 |
'yes' => $yesItypeCode->itemtype, |
| 292 |
'no' => $noItypeCode->itemtype, |
297 |
'no' => $noItypeCode->itemtype, |
| 293 |
'inherit' => $inheritItypeCode->itemtype, |
298 |
'inherit' => $inheritItypeCode->itemtype, |
| 294 |
}; |
299 |
}; |
| 295 |
|
300 |
|
| 296 |
foreach my $syspref ('hardyes','softyes','softno','hardno'){ |
301 |
foreach my $syspref ( 'hardyes', 'softyes', 'softno', 'hardno' ) { |
| 297 |
t::lib::Mocks::mock_preference( 'checkprevcheckout', $syspref ); |
302 |
t::lib::Mocks::mock_preference( 'checkprevcheckout', $syspref ); |
| 298 |
foreach my $itemtype_setting ('yes','no','inherit'){ #itemtype Setting |
303 |
foreach my $itemtype_setting ( 'yes', 'no', 'inherit' ) { #itemtype Setting |
| 299 |
my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } ); |
304 |
my $item = $builder->build_sample_item( { itype => $itypeCode->{$itemtype_setting} } ); |
| 300 |
foreach my $categorie_settings('yes','no','inherit'){ |
305 |
foreach my $categorie_settings ( 'yes', 'no', 'inherit' ) { |
| 301 |
my $catCode = $categorie_settings . 'Cat'; |
306 |
my $catCode = $categorie_settings . 'Cat'; |
| 302 |
foreach my $patron_setting('yes','no','inherit'){ |
307 |
foreach my $patron_setting ( 'yes', 'no', 'inherit' ) { |
| 303 |
my $result = undef; |
308 |
my $result = undef; |
| 304 |
$result = 1 if($syspref eq 'hardyes'); |
309 |
$result = 1 if ( $syspref eq 'hardyes' ); |
| 305 |
$result = 0 if($syspref eq 'hardno'); |
310 |
$result = 0 if ( $syspref eq 'hardno' ); |
| 306 |
$result = 1 if(!defined $result && $itemtype_setting eq 'yes'); |
311 |
$result = 1 if ( !defined $result && $itemtype_setting eq 'yes' ); |
| 307 |
$result = 0 if(!defined $result && $itemtype_setting eq 'no'); |
312 |
$result = 0 if ( !defined $result && $itemtype_setting eq 'no' ); |
| 308 |
$result = 1 if(!defined $result && $patron_setting eq 'yes'); |
313 |
$result = 1 if ( !defined $result && $patron_setting eq 'yes' ); |
| 309 |
$result = 0 if(!defined $result && $patron_setting eq 'no'); |
314 |
$result = 0 if ( !defined $result && $patron_setting eq 'no' ); |
| 310 |
$result = 1 if(!defined $result && $categorie_settings eq 'yes'); |
315 |
$result = 1 if ( !defined $result && $categorie_settings eq 'yes' ); |
| 311 |
$result = 0 if(!defined $result && $categorie_settings eq 'no'); |
316 |
$result = 0 if ( !defined $result && $categorie_settings eq 'no' ); |
| 312 |
$result = 1 if(!defined $result && $syspref eq 'softyes'); |
317 |
$result = 1 if ( !defined $result && $syspref eq 'softyes' ); |
| 313 |
$result = 0 if(!defined $result && $syspref eq 'softno'); |
318 |
$result = 0 if ( !defined $result && $syspref eq 'softno' ); |
| 314 |
my $kpatron = $builder->build( |
319 |
my $kpatron = $builder->build( |
| 315 |
{ |
320 |
{ |
| 316 |
source => 'Borrower', |
321 |
source => 'Borrower', |
| 317 |
- |
|
|