Bug 17742: Use TestBuilder to create the library and patron category
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 28 Dec 2016 08:57:14 +0000 (09:57 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Wed, 28 Dec 2016 13:34:21 +0000 (13:34 +0000)
Moreover we do not need to remove the existing issues and patrons

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/db_dependent/Patrons.t

index b0b6b60..40f770d 100755 (executable)
@@ -24,6 +24,8 @@ use C4::Context;
 use Koha::Database;
 use Koha::DateUtils;
 
+use t::lib::TestBuilder;
+
 BEGIN {
     use_ok('Koha::Objects');
     use_ok('Koha::Patrons');
@@ -33,12 +35,10 @@ BEGIN {
 my $database = Koha::Database->new();
 my $schema = $database->schema();
 $schema->storage->txn_begin();
+my $builder = t::lib::TestBuilder->new;
 
-$schema->resultset('Issue')->delete_all();
-$schema->resultset('Borrower')->delete_all();
-
-my $categorycode = $schema->resultset('Category')->first()->categorycode();
-my $branchcode = $schema->resultset('Branch')->first()->branchcode();
+my $categorycode = $builder->build({ source => 'Category' })->{categorycode};
+my $branchcode = $builder->build({ source => 'Branch' })->{branchcode};
 
 my $b1 = Koha::Patron->new(
     {