From 3356849c21c48cb37a4c31c928838cd513cebda2 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 --- t/db_dependent/Koha/Account.t | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/Account.t b/t/db_dependent/Koha/Account.t index 27d5756477..960a6e7bc2 100755 --- a/t/db_dependent/Koha/Account.t +++ b/t/db_dependent/Koha/Account.t @@ -34,6 +34,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(); } { carped => qr/No patron id passed in!/ }, 'Croaked on bad call to new'; + + my $patron = $builder->build_object({ class => 'Koha::Patrons' }); + $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 => 22; @@ -141,7 +156,7 @@ subtest 'outstanding_credits() tests' => sub { subtest 'add_credit() tests' => sub { - plan tests => 16; + plan tests => 15; $schema->storage->txn_begin; @@ -151,7 +166,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.20.1