The routines GetPendingIssues, GetAllIssues, GetMessagesCount, GetGuarantees, HasOverdues and GetExpiryDate of the module C4::Members.pm are not tested.
Created attachment 29094 [details] [review] Bug 12457: Removal warning in t/db_dependent/Members.t When I execute prove t/db_dependent/Members.t, this warning appears twice : "Argument "Test" isn't numeric in modulus (%) at /home/yohann/koha/C4/Context.pm line 1256." The warning is due to a invalid use of the routine set_userenv Test plan: 1/ Execute : prove t/db_dependent/Members.t 2/ The warning appears twice : "Argument "Test" isn't numeric in modulus (%) at /home/yohann/koha/C4/Context.pm line 1256." 3/ Apply the patch 4/ Execute : prove t/db_dependent/Members.t 5/ The result has to be a success without error or warning : t/db_dependent/Members.t .. ok All tests successful. Files=1, Tests=26, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.50 cusr 0.08 csys = 1.63 CPU) Result: PASS
Created attachment 29173 [details] [review] Bug 12457: Adding unit tests for the routines AddMessage, GetMessages, GetMessagesCount, DeleteMessage, GetPendingIssues, GetAllIssues of the module C4/Members.pm and modification of the routine GetAllIssues Adding unit tests for the routines AddMessage, GetMessages, GetMessagesCount and DeleteMessage in t/db_dependent/Members.t Adding unit tests for the routines GetPendingIssues and GetAllIssues in separate files : t/db_dependent/Members/GetPendingIssues.t and t/db_dependent/Members/GetAllIssues.t The routine GetAllIssues has been modified because it does not test if the arguments was defined : - the borrowernumber argument is required - if the order argument is not given, it takes a value by default : 'date_due desc' - the limit argument is optional Test plan: 1/ Apply the patch 2/ Execute : prove t/db_dependent/Members.t t/db_dependent/Members/GetAllIssues.t t/db_dependent/Members/GetPendingIssues.t 3/ The result has to be a success without error or warning : t/db_dependent/Members.t ................... ok t/db_dependent/Members/GetAllIssues.t ...... ok t/db_dependent/Members/GetPendingIssues.t .. ok All tests successful. Files=3, Tests=83, 5 wallclock secs ( 0.06 usr 0.01 sys + 4.68 cusr 0.26 csys = 5.01 CPU) Result: PASS
Second patch does not apply fatal: sha1 information is lacking or useless (t/db_dependent/Members.t). Repository lacks necessary blobs to fall back on 3-way merge. Cannot fall back to three-way merge. Patch failed at 0001 Bug 12457: Adding unit tests for the routines AddMessage, GetMessages, GetMessagesCount, DeleteMessage, GetPendingIssues, GetAllIssues of the module C4/Members.pm and modification of the routine GetAllIssues
Created attachment 29742 [details] [review] Bug 12457: Adding unit tests for Members.pm Adding unit tests for the routines AddMessage, GetMessages, GetMessagesCount and DeleteMessage in t/db_dependent/Members.t Adding unit tests for the routines GetPendingIssues and GetAllIssues in separate files : t/db_dependent/Members/GetPendingIssues.t and t/db_dependent/Members/GetAllIssues.t The routine GetAllIssues has been modified because it does not test if the arguments was defined : - the borrowernumber argument is required - if the order argument is not given, it takes a value by default : 'date_due desc' - the limit argument is optional Test plan: 1/ Apply the patch 2/ Execute : prove t/db_dependent/Members.t t/db_dependent/Members/GetAllIssues.t t/db_dependent/Members/GetPendingIssues.t 3/ The result has to be a success without error or warning : t/db_dependent/Members.t ................... ok t/db_dependent/Members/GetAllIssues.t ...... ok t/db_dependent/Members/GetPendingIssues.t .. ok All tests successful. Files=3, Tests=83, 5 wallclock secs ( 0.06 usr 0.01 sys + 4.68 cusr 0.26 csys = 5.01 CPU) Result: PASS
First patch Ok, test pass On second patch, first test pass, but the other two fail :( t/db_dependent/Members.t ................... ok t/db_dependent/Members/GetAllIssues.t ...... DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`kohadev`.`items`, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Members/GetAllIssues.t line 22. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`kohadev`.`items`, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Members/GetAllIssues.t line 22. # Looks like your test exited with 255 before it could output anything. t/db_dependent/Members/GetAllIssues.t ...... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 16/16 subtests t/db_dependent/Members/GetPendingIssues.t .. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`kohadev`.`items`, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Members/GetPendingIssues.t line 22. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`kohadev`.`items`, CONSTRAINT `items_ibfk_2` FOREIGN KEY (`homebranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Members/GetPendingIssues.t line 22. # Looks like your test exited with 255 before it could output anything. t/db_dependent/Members/GetPendingIssues.t .. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 20/20 subtest
Created attachment 29908 [details] [review] Bug 12457: Allow UT on a non empty database
Created attachment 30116 [details] [review] Bug 12457: Removal warning in t/db_dependent/Members.t When I execute prove t/db_dependent/Members.t, this warning appears twice : "Argument "Test" isn't numeric in modulus (%) at /home/yohann/koha/C4/Context.pm line 1256." The warning is due to a invalid use of the routine set_userenv Test plan: 1/ Execute : prove t/db_dependent/Members.t 2/ The warning appears twice : "Argument "Test" isn't numeric in modulus (%) at /home/yohann/koha/C4/Context.pm line 1256." 3/ Apply the patch 4/ Execute : prove t/db_dependent/Members.t 5/ The result has to be a success without error or warning : t/db_dependent/Members.t .. ok All tests successful. Files=1, Tests=26, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.50 cusr 0.08 csys = 1.63 CPU) Result: PASS Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 30117 [details] [review] Bug 12457: Adding unit tests for Members.pm Adding unit tests for the routines AddMessage, GetMessages, GetMessagesCount and DeleteMessage in t/db_dependent/Members.t Adding unit tests for the routines GetPendingIssues and GetAllIssues in separate files : t/db_dependent/Members/GetPendingIssues.t and t/db_dependent/Members/GetAllIssues.t The routine GetAllIssues has been modified because it does not test if the arguments was defined : - the borrowernumber argument is required - if the order argument is not given, it takes a value by default : 'date_due desc' - the limit argument is optional Test plan: 1/ Apply the patch 2/ Execute : prove t/db_dependent/Members.t t/db_dependent/Members/GetAllIssues.t t/db_dependent/Members/GetPendingIssues.t 3/ The result has to be a success without error or warning : t/db_dependent/Members.t ................... ok t/db_dependent/Members/GetAllIssues.t ...... ok t/db_dependent/Members/GetPendingIssues.t .. ok All tests successful. Files=3, Tests=83, 5 wallclock secs ( 0.06 usr 0.01 sys + 4.68 cusr 0.26 csys = 5.01 CPU) Result: PASS Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Amended patch: perltidy on t/db_dependent/Members/*
Created attachment 30118 [details] [review] Bug 12457: Allow UT on a non empty database Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
I SO on it because these patches only add unit tests and should be integrate asap.
I am sorry, but GetPendingIssues.t still fails for me: $ perl t/db_dependent/Members/GetPendingIssues.t 1..20 DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`items`, CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Members/GetPendingIssues.t line 21. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`items`, CONSTRAINT `items_ibfk_3` FOREIGN KEY (`holdingbranch`) REFERENCES `branches` (`branchcode`) ON UPDATE CASCADE) at t/db_dependent/Members/GetPendingIssues.t line 21. # Looks like your test exited with 255 before it could output anything.
Created attachment 30187 [details] [review] Bug 12457: Allow UT on a non empty database Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
I am sorry Yohann, but this still fails for me: $ perl t/db_dependent/Members/GetAllIssues.t 1..16 DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/Members/GetAllIssues.t line 20. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/Members/GetAllIssues.t line 20. # Looks like your test exited with 255 before it could output anything.
Created attachment 30266 [details] [review] Bug 12457: Allow UT on a non empty database Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 30309 [details] [review] [PASSED QA] Bug 12457: Removal warning in t/db_dependent/Members.t When I execute prove t/db_dependent/Members.t, this warning appears twice : "Argument "Test" isn't numeric in modulus (%) at /home/yohann/koha/C4/Context.pm line 1256." The warning is due to a invalid use of the routine set_userenv Test plan: 1/ Execute : prove t/db_dependent/Members.t 2/ The warning appears twice : "Argument "Test" isn't numeric in modulus (%) at /home/yohann/koha/C4/Context.pm line 1256." 3/ Apply the patch 4/ Execute : prove t/db_dependent/Members.t 5/ The result has to be a success without error or warning : t/db_dependent/Members.t .. ok All tests successful. Files=1, Tests=26, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.50 cusr 0.08 csys = 1.63 CPU) Result: PASS Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> All new and old tests pass now.
Created attachment 30310 [details] [review] [PASSED QA] Bug 12457: Adding unit tests for Members.pm Adding unit tests for the routines AddMessage, GetMessages, GetMessagesCount and DeleteMessage in t/db_dependent/Members.t Adding unit tests for the routines GetPendingIssues and GetAllIssues in separate files : t/db_dependent/Members/GetPendingIssues.t and t/db_dependent/Members/GetAllIssues.t The routine GetAllIssues has been modified because it does not test if the arguments was defined : - the borrowernumber argument is required - if the order argument is not given, it takes a value by default : 'date_due desc' - the limit argument is optional Test plan: 1/ Apply the patch 2/ Execute : prove t/db_dependent/Members.t t/db_dependent/Members/GetAllIssues.t t/db_dependent/Members/GetPendingIssues.t 3/ The result has to be a success without error or warning : t/db_dependent/Members.t ................... ok t/db_dependent/Members/GetAllIssues.t ...... ok t/db_dependent/Members/GetPendingIssues.t .. ok All tests successful. Files=3, Tests=83, 5 wallclock secs ( 0.06 usr 0.01 sys + 4.68 cusr 0.26 csys = 5.01 CPU) Result: PASS Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Amended patch: perltidy on t/db_dependent/Members/* Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Created attachment 30311 [details] [review] [PASSED QA] Bug 12457: Allow UT on a non empty database Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Patches pushed to master. Thanks Yohann!