Bug 17318: Unit tests
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 19 Sep 2016 15:17:41 +0000 (12:17 -0300)
committerKyle M Hall <kyle@bywatersolutions.com>
Fri, 21 Oct 2016 16:16:33 +0000 (16:16 +0000)
commita0af2d7d5ceb28848488c4f66e486f646341eedf
treedca62bfa7eacb4bbe5a0254cfa516ee540d6b9bc
parente155029eea393931b56370b57ade8a7f07613ef5
Bug 17318: Unit tests

The current C4::Matcher::_get_match_keys implementation doesn't take
normalization rules params into account. This patch makes Matcher.t test the
proposed behaviour for new hardcoded values, that match string normalization
routines introduced by Bu 17302.

Possible values are:
- upper_case
- lower_case
- remove_spaces
- legacy_default
- none

* 'legacy_default' is left (for now) to catch the current behaviour. So tests which
did not get a 'norm' param, now are passed 'legacy_default' and they still pass.

* 'none' means no normalization, of course

Note: on introducing 'none', a bug got highlighted, because the subfields traversal loop
was introducing an unneeded space. The tests from 17304 get adjusted to reflect this.

To test:
- Run:
  $ sudo koha-shell kohadev ; cd kohaclone
  $ prove t/Matcher.t
=> FAIL: The routine doesn't care about the norms param.

Sponsored-by: FIT
Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
t/Matcher.t