Bug 21692: created a test for Koha::Account->new
authorJasmine Amohia <jasmineamohia.student@wegc.school.nz>
Thu, 17 Jan 2019 03:33:49 +0000 (03:33 +0000)
committerLucas Gass <lucas@bywatersolutions.com>
Wed, 6 Mar 2019 16:56:19 +0000 (16:56 +0000)
Test plan:
1) Run test for /Koha/Account.t and confirm that all tests were
successful

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit 34c36a32a057c3a9be062e4ea8b6ec46c41859a0)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit d0b51ad0f47558b41208c7c7cbc19e1218cc0850)

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>

t/db_dependent/Koha/Account.t

index 9ed615e..958fc62 100755 (executable)
@@ -24,6 +24,7 @@ use Test::More tests => 3;
 use Koha::Account;
 use Koha::Account::Lines;
 
+
 use t::lib::Mocks;
 use t::lib::TestBuilder;
 
@@ -55,7 +56,6 @@ subtest 'outstanding_debits() tests' => sub {
         is_deeply( $line->unblessed, $fetched_line->unblessed, "Fetched line matches the generated one ($i)" );
         $i++;
     }
-
     my $patron_2 = $builder->build_object({ class => 'Koha::Patrons' });
     Koha::Account::Line->new({ borrowernumber => $patron_2->id, amountoutstanding => -2 })->store;
     my $just_one = Koha::Account::Line->new({ borrowernumber => $patron_2->id, amountoutstanding =>  3 })->store;
@@ -118,7 +118,7 @@ subtest 'outstanding_credits() tests' => sub {
 
 subtest 'add_credit() tests' => sub {
 
-    plan tests => 15;
+    plan tests => 16;
 
     $schema->storage->txn_begin;
 
@@ -128,6 +128,7 @@ 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' );