Bug 24759: Test intranet at the same time

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-03-03 14:26:06 +01:00 committed by Martin Renvoize
parent ec179067ad
commit 3ffe4d1623
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F

View file

@ -240,9 +240,7 @@ my $stat = $dbh->selectrow_hashref("SELECT * FROM statistics WHERE type = 'renew
ok( $stat, "Bug 17781 - 'Improper branchcode set during renewal' still fixed" );
subtest 'Show that AddRenewal respects OpacRenewalBranch and interface' => sub {
plan tests => 5;
$se->mock( 'interface', sub { return 'opac' } );
plan tests => 10;
my $item_library = $builder->build_object( { class => 'Koha::Libraries' } );
my $patron = $builder->build_object( { class => 'Koha::Patrons' } );
@ -261,19 +259,41 @@ subtest 'Show that AddRenewal respects OpacRenewalBranch and interface' => sub {
t::lib::Mocks::mock_preference( 'OpacRenewalBranch', $syspref );
my $item = $builder->build_sample_item(
{ library => $item_library->branchcode, itype => $itemtype } );
my $opac_renew_issue =
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode );
{
$se->mock( 'interface', sub { return 'opac' } );
AddRenewal( $patron->borrowernumber, $item->itemnumber,
"Stavromula", $datedue1, $daysago10 );
my $item = $builder->build_sample_item(
{ library => $item_library->branchcode, itype => $itemtype } );
my $opac_renew_issue =
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode );
my $stat = Koha::Statistics->search(
{ itemnumber => $item->itemnumber, type => 'renew' } )->next;
is( $stat->branch, $expected_branchcode,
"->renewal_branchcode is respected for OpacRenewalBranch = $syspref"
);
AddRenewal( $patron->borrowernumber, $item->itemnumber,
"Stavromula", $datedue1, $daysago10 );
my $stat = Koha::Statistics->search(
{ itemnumber => $item->itemnumber, type => 'renew' } )->next;
is( $stat->branch, $expected_branchcode,
"->renewal_branchcode is respected for OpacRenewalBranch = $syspref"
);
}
{
$se->mock( 'interface', sub { return 'intranet' } );
my $item = $builder->build_sample_item(
{ library => $item_library->branchcode, itype => $itemtype } );
my $opac_renew_issue =
C4::Circulation::AddIssue( $patron->unblessed, $item->barcode );
AddRenewal( $patron->borrowernumber, $item->itemnumber,
"Stavromula", $datedue1, $daysago10 );
my $stat = Koha::Statistics->search(
{ itemnumber => $item->itemnumber, type => 'renew' } )->next;
is( $stat->branch, $logged_in_user->branchcode,
"->renewal_branchcode is always logged in branch for intranet"
);
}
}
};