From b087c41d0c24391750aa838e3c4c7d1d8e173114 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 4 Sep 2023 16:02:30 +0200 Subject: [PATCH] Bug 32980: Use TestBuilder Also +x --- t/db_dependent/Koha/Patron/siblings.t | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/t/db_dependent/Koha/Patron/siblings.t b/t/db_dependent/Koha/Patron/siblings.t index 1b7b7cc9749..0441ca52ab2 100755 --- a/t/db_dependent/Koha/Patron/siblings.t +++ b/t/db_dependent/Koha/Patron/siblings.t @@ -2,9 +2,10 @@ use Modern::Perl; -use String::Random; use Test::More tests => 1; +use t::lib::TestBuilder; + use Koha::Database; use Koha::Patrons; @@ -14,25 +15,15 @@ subtest 'Koha::Patrons::siblings should return a Koha::Patrons object even if pa plan tests => 2; $schema->txn_begin; - my $random = String::Random->new; - - my $categorycode = $random->randpattern('CCCCCCCCCC'); - my $branchcode = $random->randpattern('CCCCCCCCCC'); - - my $category = $schema->resultset('Category')->create( { categorycode => $categorycode } ); - my $branch = $schema->resultset('Branch')->create( - { - branchcode => $branchcode, - branchname => 'Test branch for Koha::Patron::siblings tests', - } - ); - my $borrower = $schema->resultset('Borrower')->create( + my $builder = t::lib::TestBuilder->new; + my $category = $builder->build_object( { class => 'Koha::Patron::Categories' } ); + my $library = $builder->build_object( { class => 'Koha::Libraries' } ); + my $patron = $builder->build_object( { - categorycode => $categorycode, - branchcode => $branchcode, + class => 'Koha::Patrons', + value => { categorycode => $category->categorycode, branchcode => $library->branchcode } } ); - my $patron = Koha::Patrons->find( $borrower->borrowernumber ); my $siblings = $patron->siblings; isa_ok( $siblings, 'Koha::Patrons' ); -- 2.25.1