[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
Mon Oct 13 13:38:28 CEST 2014


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12603

--- Comment #19 from M. de Rooy <m.de.rooy at rijksmuseum.nl> ---
General commment:
The comment on has_one should not block this patch imo (see comment16).
[Removing the belongs_to as in bug 11518 also addresses this problem.]
The code, including some less obvious things, contains very little comments
(see also the comment of Martin about documentation).
The composite foreign keys like in the overduerules_transport_type are handled
by a trick: copy the hash from the first composite key to the other one(s). The
code in build() looks at the first key of a composite one when searching for
values. Using TestBuilder with such a table is not (immediately) clear. (And
obviously, code with such trics may not be the easiest to maintain..)
I suppose that a table with multiple composite foreign keys sharing the same
key could present a problem. I could not find an example in Koha though ;)
Passes qa script.
I will pass QA on this code, but somewhat hesitant. Note that I do not view
TestBuilder as the only way to write a test now in Koha and would not per se
recommend refactoring of existing tests. It is just an alternative.

Small remarks:
+$my_overduerules_transport_type->{categorycode} =
$my_overduerules_transport_type->{branchcode};
+my $overduerules_transport_type = $builder->build({
+    source => 'OverduerulesTransportType',
+    value  => $my_overduerules_transport_type,
+});
o my: my $overdue.. and $my_overdue.. Example of obscure variable naming?

+    $source =~ s|(\w+)$|$1|;
What are you actually changing here?

+our $default_value = {
+    UserPermission => {
TestBuilder.t contains the default value for UserPermission. Should not block
this patch, but I would rather have it somewhere else. Separate module perhaps?

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list