Skip to content

Commit

Permalink
Bug 19004: Patrons.t should create its own data for enrollment fees.
Browse files Browse the repository at this point in the history
If the patron categories J, K, YA would not exist, Patrons.t would fail.

Test plan:
[1] Remove one of these patron categories.
[2] Run t/db_dependent/Koha/Patrons.t

Signed-off-by: Marcel de Rooy <[email protected]>

Signed-off-by: Mark Tompsett <[email protected]>

Signed-off-by: Kyle M Hall <[email protected]>

Signed-off-by: Jonathan Druart <[email protected]>
(cherry picked from commit 57427f7)
Signed-off-by: Fridolin Somers <[email protected]>
(cherry picked from commit 2fdd3ef)
Signed-off-by: Katrin Fischer <[email protected]>
  • Loading branch information
mderooy authored and kfischer committed Oct 6, 2017
1 parent d790db9 commit 3435f41
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions t/db_dependent/Koha/Patrons.t
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use C4::Members;
use Koha::Holds;
use Koha::Patron;
use Koha::Patrons;
use Koha::Patron::Categories;
use Koha::Database;
use Koha::DateUtils;
use Koha::Virtualshelves;
Expand Down Expand Up @@ -325,14 +326,13 @@ subtest "delete" => sub {
subtest 'add_enrolment_fee_if_needed' => sub {
plan tests => 4;

my $enrolmentfee_K = 5;
my $enrolmentfee_J = 10;
my $enrolmentfee_YA = 20;

my $dbh = C4::Context->dbh;
$dbh->do(q|UPDATE categories set enrolmentfee=? where categorycode=?|, undef, $enrolmentfee_K, 'K');
$dbh->do(q|UPDATE categories set enrolmentfee=? where categorycode=?|, undef, $enrolmentfee_J, 'J');
$dbh->do(q|UPDATE categories set enrolmentfee=? where categorycode=?|, undef, $enrolmentfee_YA, 'YA');
my $enrolmentfees = { K => 5, J => 10, YA => 20 };
foreach( keys %{$enrolmentfees} ) {
( Koha::Patron::Categories->find( $_ ) // $builder->build_object({ class => 'Koha::Patron::Categories', value => { categorycode => $_ } }) )->enrolmentfee( $enrolmentfees->{$_} )->store;
}
my $enrolmentfee_K = $enrolmentfees->{K};
my $enrolmentfee_J = $enrolmentfees->{J};
my $enrolmentfee_YA = $enrolmentfees->{YA};

my %borrower_data = (
firstname => 'my firstname',
Expand Down

0 comments on commit 3435f41

Please sign in to comment.