Bug 10306: Add tests for module changes
authorMarcel de Rooy <m.de.rooy@rijksmuseum.nl>
Wed, 19 Jul 2017 14:54:40 +0000 (16:54 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Thu, 7 Dec 2017 17:44:15 +0000 (14:44 -0300)
commite9a4e52077cee5d150dac0c39db49930b8cff994
tree8495d4bf0844a8d4a6b596c008a5f4f8a5dce12c
parentdb32f394a636848488de4d1637d9efc5b7fcf004
Bug 10306: Add tests for module changes

GetMarcSubfieldStructure: In Biblio.t we are adding a subtest that checks
the structure returned by this routine. Is it a hashref pointing to
arrayrefs of hashrefs? ;)
In Search.t this routine was mocked. The change in the returned structure
is now applied to this mock too (moving the marc tag hashes into
arrayrefs).

GetMarcFromKohaField: In Biblio.t we add a subtest for it. We are checking
if it returns multiple mappings (per kohafield) and calling it in scalar
context too.

GetMarcSubfieldStructureFromKohaField: The existing subtest in Biblio.t is
expanded to also test the call in list context.

TransformKohaToMarc: This sub has its own test script. We are adding a
subtest in TransformKohaToMarc.t for a test with multiple mappings,
and for mapping to a control field in another framework. This also tests
the additional framework parameter.
Additionally, we add a test for the new no_split option used for items.

TransformMarcToKoha: This implicitly tests its helper sub _get_inverted.
This patch adds a new test script for this routine.

TransformMarcToKohaOneField: A few tests are added to the previous new
test script.

Test plan:
[1] Run t/db_dependent/Biblio.t
[2] Run t/db_dependent/Biblio/TransformKohaToMarc.t
[3] Run t/db_dependent/Biblio/TransformMarcToKoha.t
[4] Run t/db_dependent/Search.t

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
t/db_dependent/Biblio.t
t/db_dependent/Biblio/TransformKohaToMarc.t
t/db_dependent/Biblio/TransformMarcToKoha.t [new file with mode: 0644]
t/db_dependent/Search.t