From 34bfc86402f7b7db67ac1bed1a379604cfdd6014 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 19 Feb 2019 19:34:04 +0000 Subject: [PATCH] Bug 21692: (QA follow-up) Enhance test for new Signed-off-by: Martin Renvoize Signed-off-by: Nick Clemens (cherry picked from commit 569c64252eba27607deb9eccefe7d72678c7bbb9) Signed-off-by: Martin Renvoize (cherry picked from commit 6643dc2a94a1165a5c4ea77bdcf760385446944e) Signed-off-by: Lucas Gass --- t/db_dependent/Koha/Account.t | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index 958fc62a13..89ec7cf10e 100755 --- a/t/db_dependent/Koha/Account.t +++ b/t/db_dependent/Koha/Account.t @@ -19,7 +19,8 @@ use Modern::Perl; -use Test::More tests => 3; +use Test::More tests => 4; +use Test::Exception; use Koha::Account; use Koha::Account::Lines; @@ -31,6 +32,21 @@ use t::lib::TestBuilder; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new; +subtest 'new' => sub { + + plan tests => 2; + + $schema->storage->txn_begin; + + throws_ok { Koha::Account->new(); } qr/No patron id passed in!/, 'Croaked on bad call to new'; + + my $patron = $builder->build_object({ class => 'Koha::Patrons' }); + my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } ); + is( defined $account, 1, "Account is defined" ); + + $schema->storage->txn_rollback; +}; + subtest 'outstanding_debits() tests' => sub { plan tests => 12; @@ -118,7 +134,7 @@ subtest 'outstanding_credits() tests' => sub { subtest 'add_credit() tests' => sub { - plan tests => 16; + plan tests => 15; $schema->storage->txn_begin; @@ -128,7 +144,6 @@ subtest 'add_credit() tests' => sub { my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); my $account = Koha::Account->new( { patron_id => $patron->borrowernumber } ); - is( defined $account, 1, "Account is defined" ); is( $account->balance, 0, 'Patron has no balance' ); -- 2.39.5