Bug 7702 - Test for C4::Heading::MARC21 should only run under MARC21
Summary: Test for C4::Heading::MARC21 should only run under MARC21
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Jared Camins-Esakov
QA Contact: Ian Walls
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-11 16:48 UTC by Jared Camins-Esakov
Modified: 2013-12-05 19:57 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 7702: MARC21 heading tests should not run under UNIMARC (1.46 KB, patch)
2012-03-11 16:54 UTC, Jared Camins-Esakov
Details | Diff | Splinter Review
Bug 7702: MARC21 heading tests should not run under UNIMARC (1.63 KB, patch)
2012-03-23 15:15 UTC, Magnus Enger
Details | Diff | Splinter Review
Bug 7702: [SIGNED-OFF] MARC21 heading tests should not run under UNIMARC (1.69 KB, patch)
2012-03-23 15:16 UTC, Magnus Enger
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jared Camins-Esakov 2012-03-11 16:48:01 UTC
At the moment, the test for C4::Heading::MARC21 will try to run under UNIMARC installations, resulting in an error. It should check which marcflavour is in use, and not run the MARC21 tests if UNIMARC is active.
Comment 1 Jared Camins-Esakov 2012-03-11 16:54:12 UTC Comment hidden (obsolete)
Comment 2 Ian Walls 2012-03-20 00:39:19 UTC
To be absolutely explicit, I'd recommend change the conditional from "if not UNIMARC" to "if MARC21 OR NORMARC", so if we later implement another form of MARC, we won't have to remember to adjust this.  Ounce of prevention and all that....
Comment 3 Magnus Enger 2012-03-23 15:15:55 UTC Comment hidden (obsolete)
Comment 4 Magnus Enger 2012-03-23 15:16:57 UTC
Created attachment 8606 [details] [review]
Bug 7702: [SIGNED-OFF] MARC21 heading tests should not run under UNIMARC

Skip the MARC21-specific tests in t/Heading_MARC21.t if the marcflavour is
UNIMARC.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
I set marcflavour = UNIMARC for testing this.
Before the patch, t/Heading_MARC21.t fails. After the patch it
succeeds.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Comment 5 Magnus Enger 2012-03-23 15:17:40 UTC
$ t/Heading_MARC21.t 
1..3
ok 1 - use C4::Heading;
ok 2 - Display form generation
not ok 3 - Search form generation
#   Failed test 'Search form generation'
#   at t/Heading_MARC21.t line 18.
#          got: 'Uncles Fiction'
#     expected: 'Uncles generalsubdiv Fiction'
# Looks like you failed 1 test of 3.

$ git bz apply 7702
Bug 7702 - Test for C4::Heading::MARC21 should only run under MARC21

Bug 7702: MARC21 heading tests should not run under UNIMARC
Apply? [yn] y

Applying: Bug 7702: MARC21 heading tests should not run under UNIMARC

$ t/Heading_MARC21.t 
1..3
ok 1 - use C4::Heading;
ok 2 # skip MARC21 heading tests not applicable to UNIMARC
ok 3 # skip MARC21 heading tests not applicable to UNIMARC
Comment 6 Ian Walls 2012-03-24 14:03:42 UTC
Since our NORMARC expert has signed off on this, I'll take that as a sign that we're good with the test for 'not UNIMARC'.   Marking Passed QA.
Comment 7 Paul Poulain 2012-03-26 13:54:20 UTC
works fine for UNIMARC as well:
15:53 ~/koha.dev/koha-community (new/bug_7702 $%)$ perl t/Heading_MARC21.t
1..3
ok 1 - use C4::Heading;
ok 2 # skip MARC21 heading tests not applicable to UNIMARC
ok 3 # skip MARC21 heading tests not applicable to UNIMARC
Comment 8 Magnus Enger 2012-03-26 20:19:33 UTC
(In reply to comment #2)
> To be absolutely explicit, I'd recommend change the conditional from "if not
> UNIMARC" to "if MARC21 OR NORMARC", so if we later implement another form of
> MARC, we won't have to remember to adjust this.  Ounce of prevention and all
> that....

I think this uses the same logic as elsewhere in the code where we branch out based on the marcflavour syspref. Here's some code from C4/Koha.pm: 

if ($marcflavour eq 'UNIMARC') {
...
} else { # assume marc21 if not unimarc
...
}

NORMARC can (luckily) be treated as MARC21 in a lot of contexts.