Bug 23177: (QA follow-up) Move three subs from the middle to the top in Circulation.t

Removed trailing comma for last sub too.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit 568d3f82cb)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Marcel de Rooy 2019-06-21 09:00:27 +00:00 committed by Fridolin Somers
parent 20e0d798ac
commit eb1017fa8f
1 changed files with 47 additions and 49 deletions

View File

@ -48,6 +48,53 @@ use Koha::Account::Lines;
use Koha::Account::Offsets;
use Koha::ActionLogs;
sub set_userenv {
my ( $library ) = @_;
t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} });
}
sub str {
my ( $error, $question, $alert ) = @_;
my $s;
$s = %$error ? ' (error: ' . join( ' ', keys %$error ) . ')' : '';
$s .= %$question ? ' (question: ' . join( ' ', keys %$question ) . ')' : '';
$s .= %$alert ? ' (alert: ' . join( ' ', keys %$alert ) . ')' : '';
return $s;
}
sub test_debarment_on_checkout {
my ($params) = @_;
my $item = $params->{item};
my $library = $params->{library};
my $patron = $params->{patron};
my $due_date = $params->{due_date} || dt_from_string;
my $return_date = $params->{return_date} || dt_from_string;
my $expected_expiration_date = $params->{expiration_date};
$expected_expiration_date = output_pref(
{
dt => $expected_expiration_date,
dateformat => 'sql',
dateonly => 1,
}
);
my @caller = caller;
my $line_number = $caller[2];
AddIssue( $patron, $item->{barcode}, $due_date );
my ( undef, $message ) = AddReturn( $item->{barcode}, $library->{branchcode}, undef, $return_date );
is( $message->{WasReturned} && exists $message->{Debarred}, 1, 'AddReturn must have debarred the patron' )
or diag('AddReturn returned message ' . Dumper $message );
my $debarments = Koha::Patron::Debarments::GetDebarments(
{ borrowernumber => $patron->{borrowernumber}, type => 'SUSPENSION' } );
is( scalar(@$debarments), 1, 'Test at line ' . $line_number );
is( $debarments->[0]->{expiration},
$expected_expiration_date, 'Test at line ' . $line_number );
Koha::Patron::Debarments::DelUniqueDebarment(
{ borrowernumber => $patron->{borrowernumber}, type => 'SUSPENSION' } );
};
my $schema = Koha::Database->schema;
$schema->storage->txn_begin;
my $builder = t::lib::TestBuilder->new;
@ -3112,55 +3159,6 @@ subtest 'ProcessOfflinePayment() tests' => sub {
$schema->storage->txn_rollback;
};
sub set_userenv {
my ( $library ) = @_;
t::lib::Mocks::mock_userenv({ branchcode => $library->{branchcode} });
}
sub str {
my ( $error, $question, $alert ) = @_;
my $s;
$s = %$error ? ' (error: ' . join( ' ', keys %$error ) . ')' : '';
$s .= %$question ? ' (question: ' . join( ' ', keys %$question ) . ')' : '';
$s .= %$alert ? ' (alert: ' . join( ' ', keys %$alert ) . ')' : '';
return $s;
}
sub test_debarment_on_checkout {
my ($params) = @_;
my $item = $params->{item};
my $library = $params->{library};
my $patron = $params->{patron};
my $due_date = $params->{due_date} || dt_from_string;
my $return_date = $params->{return_date} || dt_from_string;
my $expected_expiration_date = $params->{expiration_date};
$expected_expiration_date = output_pref(
{
dt => $expected_expiration_date,
dateformat => 'sql',
dateonly => 1,
}
);
my @caller = caller;
my $line_number = $caller[2];
AddIssue( $patron, $item->{barcode}, $due_date );
my ( undef, $message ) = AddReturn( $item->{barcode}, $library->{branchcode}, undef, $return_date );
is( $message->{WasReturned} && exists $message->{Debarred}, 1, 'AddReturn must have debarred the patron' )
or diag('AddReturn returned message ' . Dumper $message );
my $debarments = Koha::Patron::Debarments::GetDebarments(
{ borrowernumber => $patron->{borrowernumber}, type => 'SUSPENSION' } );
is( scalar(@$debarments), 1, 'Test at line ' . $line_number );
is( $debarments->[0]->{expiration},
$expected_expiration_date, 'Test at line ' . $line_number );
Koha::Patron::Debarments::DelUniqueDebarment(
{ borrowernumber => $patron->{borrowernumber}, type => 'SUSPENSION' } );
};
subtest 'Incremented fee tests' => sub {
plan tests => 11;