From 230f2c8e0228335dc89dfda44f6bb5538fb2fb9e Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 16 Aug 2016 16:59:38 +0100 Subject: [PATCH] Bug 16272: Add description for tests Signed-off-by: Nick Clemens --- t/db_dependent/Circulation/SwitchOnSiteCheckouts.t | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t b/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t index 5a46a20..d8df911 100644 --- a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t +++ b/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t @@ -15,7 +15,7 @@ # with Koha; if not, see . use Modern::Perl; -use Test::More tests => 8; +use Test::More tests => 9; use C4::Context; use C4::Biblio; @@ -94,16 +94,17 @@ C4::Circulation::AddIssue( $patron, $item->{barcode}, dt_from_string, undef, dt_ my ( $impossible, $messages ); t::lib::Mocks::mock_preference('SwitchOnSiteCheckouts', 0); ( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} ); -is( $impossible->{NO_RENEWAL_FOR_ONSITE_CHECKOUTS}, 1, '' ); +is( $impossible->{NO_RENEWAL_FOR_ONSITE_CHECKOUTS}, 1, 'Do not renew on-site checkouts' ); t::lib::Mocks::mock_preference('SwitchOnSiteCheckouts', 1); -( undef, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} ); -is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' ); +( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $item->{barcode} ); +is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'If SwitchOnSiteCheckouts, switch the on-site checkout' ); +is( exists $impossible->{TOO_MANY}, '', 'If SwitchOnSiteCheckouts, switch the on-site checkout' ); C4::Circulation::AddIssue( $patron, $item->{barcode}, undef, undef, undef, undef, { switch_onsite_checkout => 1 } ); my $issue = C4::Circulation::GetItemIssue( $item->{itemnumber} ); -is( $issue->{onsite_checkout}, 0, '' ); +is( $issue->{onsite_checkout}, 0, 'The issue should have been switched to a regular checkout' ); my $five_days_after = dt_from_string->add( days => 5 )->set( hour => 23, minute => 59, second => 0 ); -is( $issue->{date_due}, $five_days_after ); +is( $issue->{date_due}, $five_days_after, 'The date_due should have been set depending on the circ rules when the on-site checkout has been switched' ); # Specific case t::lib::Mocks::mock_preference('ConsiderOnSiteCheckoutsAsNormalCheckouts', 1); @@ -118,8 +119,8 @@ my $another_item = $builder->build({ C4::Circulation::AddIssue( $patron, $another_item->{barcode}, dt_from_string, undef, dt_from_string, undef, { onsite_checkout => 1 } ); ( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} ); -is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' ); -is( exists $impossible->{TOO_MANY}, '', '' ); +is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'Specific case 1 - Switch is allowed' ); +is( exists $impossible->{TOO_MANY}, '', 'Specific case 1 - Switch is allowed' ); $dbh->do(q|DELETE FROM issuingrules|); my $borrower_circ_rule = $builder->build({ @@ -132,8 +133,8 @@ my $borrower_circ_rule = $builder->build({ }, }); ( $impossible, undef, undef, $messages ) = C4::Circulation::CanBookBeIssued( $patron, $another_item->{barcode} ); -is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, '' ); -is( exists $impossible->{TOO_MANY}, '', '' ); +is( $messages->{ONSITE_CHECKOUT_WILL_BE_SWITCHED}, 1, 'Specific case 2 - Switch is allowed' ); +is( exists $impossible->{TOO_MANY}, '', 'Specific case 2 - Switch is allowed' ); $schema->storage->txn_rollback; -- 2.1.4