[Koha-bugs] [Bug 12443] Initial re-factoring of buildQuery
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Jun 23 20:02:06 CEST 2014
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12443
--- Comment #8 from Tomás Cohen Arazi <tomascohen at gmail.com> ---
(In reply to David Cook from comment #7)
> (In reply to Tomás Cohen Arazi from comment #6)
> > I'd like to see some unit tests for such a sensitive core functionality.
> > I know it is an almost trivial change, but we are introducing a new function
> > to C4::Search which needs to be documented (ut-driven documentation).
> >
> > It does, OTOH, look fine to me and would push it soon. If help is needed on
> > writing those tests don't hesitate to write me.
>
> I was thinking about unit tests when I wrote the patch, but I'm not really
> sure what sort of test would be appropriate for this type of function.
>
> I can write the test, but I don't know what to test, if that makes sense.
You could start by looking at t/db_dependent/Search.t for stuff like this:
<code>
( $error, $query, $simple_query, $query_cgi,
$query_desc, $limit, $limit_cgi, $limit_desc,
$stopwords_removed, $query_type ) = buildQuery([ 'and' ], [ 'salud', 'higiene'
], [], [], [], 0, 'en');
like($query, qr/kw\W.*salud\W.*and.*kw\W.*higiene/, "Built composed
explicit-and CCL keyword query");
</code>
And build scenarios that cover all conditional paths.
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list