Bug 19036: (follow-up) Test credits should be credits
authorMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 20 Aug 2020 11:52:09 +0000 (12:52 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 21 Aug 2020 10:32:43 +0000 (12:32 +0200)
A series of accountlines added to mock credits were being added with a
debit_type_code instead of a valid credit_type_code and so were being
mis-identified by the new credit numbering code trigger in the store
routine.

This patch updates the test to correctly identify the credits as credits

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

t/db_dependent/Koha/Account/Lines.t

index c9151f4..039fb80 100755 (executable)
@@ -71,8 +71,7 @@ subtest 'total_outstanding() tests' => sub {
 
     my $credit_1 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => -10,
             interface         => 'commandline',
@@ -84,8 +83,7 @@ subtest 'total_outstanding() tests' => sub {
 
     my $credit_2 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => -10,
             interface         => 'commandline',
@@ -97,8 +95,7 @@ subtest 'total_outstanding() tests' => sub {
 
     my $credit_3 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -100,
             amountoutstanding => -100,
             interface         => 'commandline',
@@ -147,8 +144,7 @@ subtest 'total() tests' => sub {
 
     my $credit_1 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => -10,
             interface         => 'commandline',
@@ -160,8 +156,7 @@ subtest 'total() tests' => sub {
 
     my $credit_2 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => -10,
             interface         => 'commandline',
@@ -173,8 +168,7 @@ subtest 'total() tests' => sub {
 
     my $credit_3 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -100,
             amountoutstanding => -100,
             interface         => 'commandline',
@@ -223,8 +217,7 @@ subtest 'credits_total() tests' => sub {
 
     my $credit_1 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => -10,
             interface         => 'commandline',
@@ -236,8 +229,7 @@ subtest 'credits_total() tests' => sub {
 
     my $credit_2 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => -10,
             interface         => 'commandline',
@@ -249,8 +241,7 @@ subtest 'credits_total() tests' => sub {
 
     my $credit_3 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -100,
             amountoutstanding => -100,
             interface         => 'commandline',
@@ -299,8 +290,7 @@ subtest 'debits_total() tests' => sub {
 
     my $credit_1 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => 0,
             interface         => 'commandline',
@@ -312,8 +302,7 @@ subtest 'debits_total() tests' => sub {
 
     my $credit_2 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -10,
             amountoutstanding => 0,
             interface         => 'commandline',
@@ -325,8 +314,7 @@ subtest 'debits_total() tests' => sub {
 
     my $credit_3 = Koha::Account::Line->new(
         {   borrowernumber    => $patron->id,
-            debit_type_code   => "OVERDUE",
-            status            => "RETURNED",
+            credit_type_code  => "PAYMENT",
             amount            => -100,
             amountoutstanding => 0,
             interface         => 'commandline',