From 34766df0aa22db6150bf22a27fbf9a60a7a9b6e0 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 19 Oct 2015 07:15:22 -0400 Subject: [PATCH] Bug 7560 [QA Followup] - Fix up unit test --- t/db_dependent/Accounts.t | 59 ++++++++++++++++++++------------------------ 1 files changed, 27 insertions(+), 32 deletions(-) diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 95a3df2..024154c 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -291,48 +291,43 @@ subtest "makepartialpayment() tests" => sub { } }; -subtest "makepartialpayment() tests" => sub { +subtest "GetTotalFines tests" => sub { plan tests => 1; my $categorycode = $builder->build( { source => 'Category' } )->{categorycode}; - my $borrower = Koha::Borrower->new( + my $borrower = $builder->build( { - surname => 'Hall', - firstname => 'Kyle', - categorycode => $categorycode, - branchcode => $branchcode, + source => 'Borrower', + value => { + categorycode => $categorycode, + branchcode => $branchcode, + } } - )->store(); + ); - my $sth = $dbh->prepare( - q{ -INSERT INTO accountlines ( - borrowernumber , - accountno , - itemnumber , - date , - amount , - description , - dispute , - accounttype , - amountoutstanding , - lastincrement , - timestamp , - notify_id , - notify_level , - note , - manager_id - ) -VALUES - ( ?, '32766', NULL , '2013-07-31', '1.000000', NULL , NULL , NULL , '1.000000', NULL , '2013-07-31 10:21:01', '0', '0', NULL , NULL), - ( ?, '32767', NULL , '2013-07-31', '2.000000', NULL , NULL , NULL , '2.000000', NULL , '2013-07-31 10:21:01', '0', '0', NULL , NULL) -} + my $accountline1 = $builder->build( + { + source => 'Accountline', + value => { + borrowernumber => $borrower->{borrowernumber}, + amountoutstanding => '1.00', + } + } + ); + + my $accountline2 = $builder->build( + { + source => 'Accountline', + value => { + borrowernumber => $borrower->{borrowernumber}, + amountoutstanding => '2.00', + } + } ); - $sth->execute( $borrower->borrowernumber, $borrower->borrowernumber ); - ok( GetTotalFines( $borrower->borrowernumber ) == 3, "GetTotalFines functions correctly" ); + is( GetTotalFines( $borrower->{borrowernumber} ), '3.000000', "GetTotalFines functions correctly" ); }; $dbh->rollback; -- 1.7.2.5