Hi everyone, on my QA-related tasks I've found many of us use TestBuilder to generate random data for our tests (YAY!).
I just wanted to remind you that TestBuilder can now return Koha::Object-derived objects instead of just unblessed hashes now, through a new method:
my $builder = t::lib::TestBuilder->new();
my $patron = $builder->build_object({ class => 'Koha::Patrons' });
It was introduced to avoid this pattern we see very often on the tests:
my $builder = t::lib::TestBuilder->new();
my $patron_id = $builder->build({ source => 'Borrower' })->{'borrowernumber'};
my $patron = Koha::Patrons->find( $patron_id );
(or just to make use of object accessors without all the symbols handling hashrefs add, like in $patron->{'borrowernumber'}
At some point we could make ->build_object() replace ->build() for simplicity.
Regards