Lines 1019-1025
subtest 'deletion' => sub {
Link Here
|
1019 |
}; |
1019 |
}; |
1020 |
|
1020 |
|
1021 |
subtest 'renewal_branchcode' => sub { |
1021 |
subtest 'renewal_branchcode' => sub { |
1022 |
plan tests => 13; |
1022 |
plan tests => 25; |
1023 |
|
1023 |
|
1024 |
$schema->storage->txn_begin; |
1024 |
$schema->storage->txn_begin; |
1025 |
|
1025 |
|
Lines 1063-1068
subtest 'renewal_branchcode' => sub {
Link Here
|
1063 |
is( $item->renewal_branchcode, $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item"); |
1063 |
is( $item->renewal_branchcode, $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item"); |
1064 |
is( $item->renewal_branchcode({branch=>'MANATEE'}), $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item even if branch passed"); |
1064 |
is( $item->renewal_branchcode({branch=>'MANATEE'}), $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item even if branch passed"); |
1065 |
|
1065 |
|
|
|
1066 |
C4::Context->interface( 'api' ); |
1067 |
|
1068 |
t::lib::Mocks::mock_preference('RESTAPIRenewalBranch', undef); |
1069 |
is( $item->renewal_branchcode, 'APIRenew', "If interface api and RESTAPIRenewalBranch undef, we get APIRenew"); |
1070 |
is( $item->renewal_branchcode({branch=>'COW'}), 'APIRenew', "If interface api and RESTAPIRenewalBranch undef, we get APIRenew even if branch passed"); |
1071 |
|
1072 |
t::lib::Mocks::mock_preference('RESTAPIRenewalBranch', 'none'); |
1073 |
is( $item->renewal_branchcode, '', "If interface api and RESTAPIRenewalBranch is none, we get blank string"); |
1074 |
is( $item->renewal_branchcode({branch=>'COW'}), '', "If interface api and RESTAPIRenewalBranch is none, we get blank string even if branch passed"); |
1075 |
|
1076 |
t::lib::Mocks::mock_preference('RESTAPIRenewalBranch', 'checkoutbranch'); |
1077 |
is( $item->renewal_branchcode, $checkout->branchcode, "If interface api and RESTAPIRenewalBranch set to checkoutbranch, we get branch of checkout"); |
1078 |
is( $item->renewal_branchcode({branch=>'MONKEY'}), $checkout->branchcode, "If interface api and RESTAPIRenewalBranch set to checkoutbranch, we get branch of checkout even if branch passed"); |
1079 |
|
1080 |
t::lib::Mocks::mock_preference('RESTAPIRenewalBranch','patronhomebranch'); |
1081 |
is( $item->renewal_branchcode, $checkout->patron->branchcode, "If interface api and RESTAPIRenewalBranch set to patronbranch, we get branch of patron"); |
1082 |
is( $item->renewal_branchcode({branch=>'TURKEY'}), $checkout->patron->branchcode, "If interface api and RESTAPIRenewalBranch set to patronbranch, we get branch of patron even if branch passed"); |
1083 |
|
1084 |
t::lib::Mocks::mock_preference('RESTAPIRenewalBranch','itemhomebranch'); |
1085 |
is( $item->renewal_branchcode, $item->homebranch, "If interface api and RESTAPIRenewalBranch set to itemhomebranch, we get homebranch of item"); |
1086 |
is( $item->renewal_branchcode({branch=>'MANATEE'}), $item->homebranch, "If interface api and RESTAPIRenewalBranch set to itemhomebranch, we get homebranch of item even if branch passed"); |
1087 |
|
1088 |
t::lib::Mocks::mock_userenv({ branchcode => $branch->branchcode }); |
1089 |
t::lib::Mocks::mock_preference('RESTAPIRenewalBranch','apiuserbranch'); |
1090 |
is( $item->renewal_branchcode, $branch->branchcode, "If interface api and RESTAPIRenewalBranch set to apiuserbranch, we get branch from userenv"); |
1091 |
is( $item->renewal_branchcode({branch=>'MANATEE'}), $branch->branchcode, "If interface api and RESTAPIRenewalBranch set to apiuserbranch, we get branch from userenv even if branch passed"); |
1092 |
C4::Context->set_userenv(51, 'userid4tests', undef, 'firstname', 'surname', undef, undef, 0, undef, undef, undef ); #mock userenv doesn't let us set null branch |
1093 |
|
1066 |
$schema->storage->txn_rollback; |
1094 |
$schema->storage->txn_rollback; |
1067 |
}; |
1095 |
}; |
1068 |
|
1096 |
|
1069 |
- |
|
|