[Koha-bugs] [Bug 12603] TestBuilder - Module to simplify the writing of tests
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Thu Aug 21 11:49:07 CEST 2014
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12603
--- Comment #13 from Yohann Dufour <yohann.dufour at biblibre.com> ---
Moreover, the major issue with Test::DBIx::Class::Factory is that you cannot
create only the foreign keys for your object.
For instance, if I want to test the order in the acquisition module :
To create an order, I have to create first :
- a basket (which needs a bookseller)
- a budget
- a biblio
With TestBuilder, you can do something like that :
my $order = $builder->build({
source => 'Aqorder',
only_fk => 1,
})
The parameter only_fk allows one to insert in database only the foreign keys :
basket, budget and biblio and it returns an hashref to create the order.
Then, you can call the NewOrder routine like that : NewOrder($order)
With Test::DBIx::Class::Factory, you can do something similar :
my $order = $factory->create_record('Aqorder')
But it inserts the order in the database, so you cannot test then the NewOrder
routine since it is already in the database. Moreover, it returns a DBIx::Class
Object which is not compatible with what expects the New or Add routines.
Thus, according to me, Test::DBIx::Class::Factory is not compatible with how we
test the Koha modules.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list