Lines 330-336
subtest 'pickup_locations' => sub {
Link Here
|
330 |
$schema->storage->txn_rollback; |
330 |
$schema->storage->txn_rollback; |
331 |
}; |
331 |
}; |
332 |
|
332 |
|
333 |
subtest 'renewalbranch' => sub { |
333 |
subtest 'renewal_branchcode' => sub { |
334 |
plan tests => 15; |
334 |
plan tests => 15; |
335 |
|
335 |
|
336 |
$schema->storage->txn_begin; |
336 |
$schema->storage->txn_begin; |
Lines 348-378
subtest 'renewalbranch' => sub {
Link Here
|
348 |
C4::Context->interface( 'intranet' ); |
348 |
C4::Context->interface( 'intranet' ); |
349 |
t::lib::Mocks::mock_userenv({ branchcode => $branch->branchcode }); |
349 |
t::lib::Mocks::mock_userenv({ branchcode => $branch->branchcode }); |
350 |
|
350 |
|
351 |
is( $item->renewalbranch, $branch->branchcode, "If interface not opac, we get the branch from context"); |
351 |
is( $item->renewal_branchcode, $branch->branchcode, "If interface not opac, we get the branch from context"); |
352 |
is( $item->renewalbranch({ branch => "PANDA"}), $branch->branchcode, "If interface not opac, we get the branch from context even if we pass one in"); |
352 |
is( $item->renewal_branchcode({ branch => "PANDA"}), $branch->branchcode, "If interface not opac, we get the branch from context even if we pass one in"); |
353 |
C4::Context->set_userenv(51, 'userid4tests', undef, 'firstname', 'surname', undef, undef, 0, undef, undef, undef ); #mock userenv doesn't let us set null branch |
353 |
C4::Context->set_userenv(51, 'userid4tests', undef, 'firstname', 'surname', undef, undef, 0, undef, undef, undef ); #mock userenv doesn't let us set null branch |
354 |
is( $item->renewalbranch({ branch => "PANDA"}), "PANDA", "If interface not opac, we get the branch we pass one in if context not set"); |
354 |
is( $item->renewal_branchcode({ branch => "PANDA"}), "PANDA", "If interface not opac, we get the branch we pass one in if context not set"); |
355 |
|
355 |
|
356 |
C4::Context->interface( 'opac' ); |
356 |
C4::Context->interface( 'opac' ); |
357 |
|
357 |
|
358 |
t::lib::Mocks::mock_preference('OpacRenewalBranch', undef); |
358 |
t::lib::Mocks::mock_preference('OpacRenewalBranch', undef); |
359 |
is( $item->renewalbranch, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew"); |
359 |
is( $item->renewal_branchcode, 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew"); |
360 |
is( $item->renewalbranch({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed"); |
360 |
is( $item->renewal_branchcode({branch=>'COW'}), 'OPACRenew', "If interface opac and OpacRenewalBranch undef, we get OPACRenew even if branch passed"); |
361 |
|
361 |
|
362 |
t::lib::Mocks::mock_preference('OpacRenewalBranch', 'none'); |
362 |
t::lib::Mocks::mock_preference('OpacRenewalBranch', 'none'); |
363 |
is( $item->renewalbranch, '', "If interface opac and OpacRenewalBranch is none, we get blank string"); |
363 |
is( $item->renewal_branchcode, '', "If interface opac and OpacRenewalBranch is none, we get blank string"); |
364 |
is( $item->renewalbranch({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is none, we get blank string even if branch passed"); |
364 |
is( $item->renewal_branchcode({branch=>'COW'}), '', "If interface opac and OpacRenewalBranch is none, we get blank string even if branch passed"); |
365 |
|
365 |
|
366 |
t::lib::Mocks::mock_preference('OpacRenewalBranch', 'checkoutbranch'); |
366 |
t::lib::Mocks::mock_preference('OpacRenewalBranch', 'checkoutbranch'); |
367 |
is( $item->renewalbranch, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout"); |
367 |
is( $item->renewal_branchcode, $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout"); |
368 |
is( $item->renewalbranch({branch=>'MONKEY'}), $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout even if branch passed"); |
368 |
is( $item->renewal_branchcode({branch=>'MONKEY'}), $checkout->branchcode, "If interface opac and OpacRenewalBranch set to checkoutbranch, we get branch of checkout even if branch passed"); |
369 |
|
369 |
|
370 |
t::lib::Mocks::mock_preference('OpacRenewalBranch','patronhomebranch'); |
370 |
t::lib::Mocks::mock_preference('OpacRenewalBranch','patronhomebranch'); |
371 |
is( $item->renewalbranch, $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron"); |
371 |
is( $item->renewal_branchcode, $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron"); |
372 |
is( $item->renewalbranch({branch=>'TURKEY'}), $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron even if branch passed"); |
372 |
is( $item->renewal_branchcode({branch=>'TURKEY'}), $checkout->patron->branchcode, "If interface opac and OpacRenewalBranch set to patronbranch, we get branch of patron even if branch passed"); |
373 |
|
373 |
|
374 |
t::lib::Mocks::mock_preference('OpacRenewalBranch','itemhomebranch'); |
374 |
t::lib::Mocks::mock_preference('OpacRenewalBranch','itemhomebranch'); |
375 |
is( $item->renewalbranch, $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item"); |
375 |
is( $item->renewal_branchcode, $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item"); |
376 |
is( $item->renewalbranch({branch=>'MANATEE'}), $item->homebranch, "If interface opac and OpacRenewalBranch set to itemhomebranch, we get homebranch of item even if branch passed"); |
376 |
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"); |
377 |
|
377 |
|
378 |
}; |
378 |
}; |
379 |
- |
|
|