Bug 12470

Summary: C4::Circulations.pm needs more unit tests
Product: Koha Reporter: Yohann Dufour <yohann.dufour>
Component: Test SuiteAssignee: Yohann Dufour <yohann.dufour>
Status: CLOSED FIXED QA Contact: Galen Charlton <gmcharlt>
Severity: normal    
Priority: P5 - low CC: bgkriegel, chris, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm
Bug 12470: Allow execution of UTs on a DB with items
Bug 12470: Allow execution of UTs on a DB with items (fix the order)
[SIGNED-OFF] Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm
[PASSED QA] Bug 12470: adding unit tests for the routines CheckValidBarCode and CheckIfIssuedToPatron of the module C4::Circulation.pm

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 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 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.