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

-- 
Tomás Cohen Arazi
Theke Solutions (https://theke.io <http://theke.io/>)
✆ +54 9351 3513384
GPG: B2F3C15F
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to