Bug 12470 - C4::Circulations.pm needs more unit tests
Summary: C4::Circulations.pm needs more unit tests
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Yohann Dufour
QA Contact: Galen Charlton
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-24 09:24 UTC by Yohann Dufour
Modified: 2015-06-04 23:30 UTC (History)
3 users (show)

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


Attachments
Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm (9.22 KB, patch)
2014-06-24 12:30 UTC, Yohann Dufour
Details | Diff | Splinter Review
Bug 12470: Allow execution of UTs on a DB with items (1.46 KB, patch)
2014-06-27 07:14 UTC, Yohann Dufour
Details | Diff | Splinter Review
Bug 12470: Allow execution of UTs on a DB with items (fix the order) (1.55 KB, patch)
2014-07-09 07:27 UTC, Yohann Dufour
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm (9.38 KB, patch)
2014-07-09 16:06 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
[PASSED QA] Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm (9.50 KB, patch)
2014-07-11 15:35 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Yohann Dufour 2014-06-24 09:24:54 UTC
The routines CheckValidBarcode and CheckIfIssuedPatron are not tested.
Comment 1 Yohann Dufour 2014-06-24 12:30:22 UTC Comment hidden (obsolete)
Comment 2 Chris Cormack 2014-06-26 22:48:46 UTC
DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_test`.`items`, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Circulation/CheckIfIssuedToPatron.t line 26.
DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_test`.`items`, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Circulation/CheckIfIssuedToPatron.t line 26.
Comment 3 Yohann Dufour 2014-06-27 07:14:58 UTC Comment hidden (obsolete)
Comment 4 Bernardo Gonzalez Kriegel 2014-07-08 17:53:50 UTC
Yohann,
you need to swap this two lines on the two files.

$dbh->do(q|DELETE FROM items|);
$dbh->do(q|DELETE FROM issues|);

Both tests fails.
Comment 5 Yohann Dufour 2014-07-09 07:27:43 UTC Comment hidden (obsolete)
Comment 6 Bernardo Gonzalez Kriegel 2014-07-09 13:05:16 UTC
Hi Yohan, ready to be signed, works well :)

But... can you squash and resubmit?
Or add your fixes to first patch and obsolete last two.
Comment 7 Bernardo Gonzalez Kriegel 2014-07-09 16:06:30 UTC Comment hidden (obsolete)
Comment 8 Kyle M Hall (khall) 2014-07-11 15:35:16 UTC
Created attachment 29647 [details] [review]
[PASSED QA] Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm

The routines CheckValidBarcode and CheckIfIssuedToPatron were not tested

Test plan:
1/ Apply the patch
2/ Execute : prove t/db_dependent/Circulation/CheckValidBarcode.t t/db_dependent/Circulation/CheckIfIssuedToPatron.t
3/ The result of the command has to be a success without error or warning :
t/db_dependent/Circulation/CheckValidBarcode.t ...... ok
t/db_dependent/Circulation/CheckIfIssuedToPatron.t .. ok
All tests successful.
Files=2, Tests=32,  3 wallclock secs ( 0.04 usr  0.01 sys +  2.88 cusr  0.17 csys =  3.10 CPU)
Result: PASS

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Patches squashed
Tests pass, no koha-qa errors

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Tests pass using sample data provided with Koha
Comment 9 Tomás Cohen Arazi (tcohen) 2014-07-14 12:02:34 UTC
Patch pushed to master.

Thanks Yohann!
Comment 10 Galen Charlton 2014-07-23 21:35:59 UTC
Pushed to 3.16.x for inclusion in 3.16.2.