[Bug 12427] New: C4::Members::Attributes.pm needs unit tests
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Bug ID: 12427 Summary: C4::Members::Attributes.pm needs unit tests Change sponsored?: --- Product: Koha Version: unspecified Hardware: All OS: All Status: NEW Severity: normal Priority: P5 - low Component: Test Suite Assignee: chris@bigballofwax.co.nz Reporter: yohann.dufour@biblibre.com QA Contact: gmcharlt@gmail.com The module C4::Members::Attributes.pm is not tested -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Yohann Dufour <yohann.dufour@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|chris@bigballofwax.co.nz |yohann.dufour@biblibre.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Yohann Dufour <yohann.dufour@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #1 from Yohann Dufour <yohann.dufour@biblibre.com> --- Created attachment 28919 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=28919&action=edit Bug 12427: adding unit tests of module C4::Members::Attributes.pm The subroutines UpdateBorrowerAttribute, SearchIdMatchingAttribute, DeleteBorrowerAttribute, GetBorrowerAttributes, GetAttributes, GetBorrowerAttributeValue, SetBorrowerAttributes and CheckUniqueness of the module C4::Members::Attributes.pm was not tested Test plan: 1/ Execute the command: prove t/db_dependent/Members_Attributes.t 2/ The result has to be: t/db_dependent/Members_Attributes.t .. ok All tests successful. Files=1, Tests=60, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.08 csys = 1.58 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Yohann Dufour <yohann.dufour@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #28919|0 |1 is obsolete| | --- Comment #2 from Yohann Dufour <yohann.dufour@biblibre.com> --- Created attachment 28921 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=28921&action=edit Bug 12427: adding unit tests of module C4::Members::Attributes.pm The subroutines UpdateBorrowerAttribute, SearchIdMatchingAttribute, DeleteBorrowerAttribute, GetBorrowerAttributes, GetAttributes, GetBorrowerAttributeValue, SetBorrowerAttributes and CheckUniqueness of the module C4::Members::Attributes.pm were not tested. Test plan: 1/ Execute the command: prove t/db_dependent/Members_Attributes.t 2/ The result has to be: t/db_dependent/Members_Attributes.t .. ok All tests successful. Files=1, Tests=60, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.08 csys = 1.58 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Yohann Dufour <yohann.dufour@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #28921|0 |1 is obsolete| | --- Comment #3 from Yohann Dufour <yohann.dufour@biblibre.com> --- Created attachment 28922 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=28922&action=edit Bug 12427: adding unit tests of module C4::Members::Attributes.pm The subroutines UpdateBorrowerAttribute, SearchIdMatchingAttribute, DeleteBorrowerAttribute, GetBorrowerAttributes, GetAttributes, GetBorrowerAttributeValue, SetBorrowerAttributes and CheckUniqueness of the module C4::Members::Attributes.pm was not tested Test plan: 1/ Execute the command: prove t/db_dependent/Members_Attributes.t 2/ The result has to be: t/db_dependent/Members_Attributes.t .. ok All tests successful. Files=1, Tests=60, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.08 csys = 1.58 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Yohann Dufour <yohann.dufour@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #28921|1 |0 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Chris Cormack <chris@bigballofwax.co.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion CC| |chris@bigballofwax.co.nz --- Comment #4 from Chris Cormack <chris@bigballofwax.co.nz> --- DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_test`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/Members_Attributes.t line 34. DBD::mysql::db do failed: Cannot delete or update a parent row: a foreign key constraint fails (`koha_test`.`issues`, CONSTRAINT `issues_ibfk_1` FOREIGN KEY (`borrowernumber`) REFERENCES `borrowers` (`borrowernumber`) ON UPDATE CASCADE) at t/db_dependent/Members_Attributes.t line 34. # Looks like you planned 60 tests but ran 1. # Looks like your test exited with 255 just after 1. Fails on a non empty db, (ie if you have any borrowers who have attributes in the database). Do we care about that? Or do we only care that it passes on an empty (or near empty) database? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@biblibre.co | |m --- Comment #5 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Chris Cormack from comment #4)
Do we care about that? Or do we only care that it passes on an empty (or near empty) database?
Hi Chris, I recommend to Yohann to execute the unit tests with the DB generated by the patch on bug 10337. I have been doing this for 1 year now. All db_dependent tests pass using this DB (except the 3 broken currently). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I feel it would be nice if the unit tests could be run on any db - maybe the patch could be improved a little for the case Chris found? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #7 from Jonathan Druart <jonathan.druart@biblibre.com> --- Looking quickly at this patch, the only dependencies are + categorycode => 'S', + branchcode => 'CPL', This is the case for almost ALL db dependent unit tests. Some tests are very painful to write (for instance, try to write a unit tests in the ACQ module...). It is good not to have to add all data before starting to test something. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #8 from Jonathan Druart <jonathan.druart@biblibre.com> --- However, I think this discussion should have done on bug 10337 (in discussion for 1 year ago). -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- You are right, that this is not the right place for a general discussion. I was referring to this comment from Chris:
Fails on a non empty db, (ie if you have any borrowers who have attributes in >the database
Maybe it would be enough then to add another delete line to make sure there are no other borrowers with patron attributes? -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Jonathan Druart <jonathan.druart@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #28921|0 |1 is obsolete| | Attachment #28922|0 |1 is obsolete| | --- Comment #10 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 29008 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29008&action=edit Bug 12427: adding unit tests of module C4::Members::Attributes.pm The subroutines UpdateBorrowerAttribute, SearchIdMatchingAttribute, DeleteBorrowerAttribute, GetBorrowerAttributes, GetAttributes, GetBorrowerAttributeValue, SetBorrowerAttributes and CheckUniqueness of the module C4::Members::Attributes.pm were not tested. Test plan: 1/ Execute the command: prove t/db_dependent/Members_Attributes.t 2/ The result has to be: t/db_dependent/Members_Attributes.t .. ok All tests successful. Files=1, Tests=60, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.08 csys = 1.58 CPU) Result: PASS -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #11 from Jonathan Druart <jonathan.druart@biblibre.com> --- Created attachment 29009 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29009&action=edit Bug 12427: Allow execution of UTs on a DB with issues -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #12 from Jonathan Druart <jonathan.druart@biblibre.com> --- (In reply to Katrin Fischer from comment #9)
Maybe it would be enough then to add another delete line to make sure there are no other borrowers with patron attributes?
Agreed, the deletion failed if the DB contains issues. I squashed the 2 first patches and added a follow-up. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #29008|0 |1 is obsolete| | --- Comment #13 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 29153 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29153&action=edit [SIGNED-OFF] Bug 12427: adding unit tests of module C4::Members::Attributes.pm The subroutines UpdateBorrowerAttribute, SearchIdMatchingAttribute, DeleteBorrowerAttribute, GetBorrowerAttributes, GetAttributes, GetBorrowerAttributeValue, SetBorrowerAttributes and CheckUniqueness of the module C4::Members::Attributes.pm were not tested. Test plan: 1/ Execute the command: prove t/db_dependent/Members_Attributes.t 2/ The result has to be: t/db_dependent/Members_Attributes.t .. ok All tests successful. Files=1, Tests=60, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.08 csys = 1.58 CPU) Result: PASS Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Test with patrons on db having issues and attributes New test file, all test pass No koha-qa errors -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #29009|0 |1 is obsolete| | --- Comment #14 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 29154 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29154&action=edit [SIGNED-OFF] Bug 12427: Allow execution of UTs on a DB with issues Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |bgkriegel@gmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #29153|0 |1 is obsolete| | Attachment #29154|0 |1 is obsolete| | --- Comment #15 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 29185 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29185&action=edit [PASSED QA] Bug 12427: adding unit tests of module C4::Members::Attributes.pm The subroutines UpdateBorrowerAttribute, SearchIdMatchingAttribute, DeleteBorrowerAttribute, GetBorrowerAttributes, GetAttributes, GetBorrowerAttributeValue, SetBorrowerAttributes and CheckUniqueness of the module C4::Members::Attributes.pm were not tested. Test plan: 1/ Execute the command: prove t/db_dependent/Members_Attributes.t 2/ The result has to be: t/db_dependent/Members_Attributes.t .. ok All tests successful. Files=1, Tests=60, 2 wallclock secs ( 0.04 usr 0.01 sys + 1.45 cusr 0.08 csys = 1.58 CPU) Result: PASS Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Test with patrons on db having issues and attributes New test file, all test pass No koha-qa errors Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 --- Comment #16 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 29186 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=29186&action=edit [PASSED QA] Bug 12427: Allow execution of UTs on a DB with issues Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |tomascohen@gmail.com --- Comment #17 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Patches pushed to master. Thanks Yohann -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12427 Galen Charlton <gmcharlt@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |Pushed to Stable --- Comment #18 from Galen Charlton <gmcharlt@gmail.com> --- Pushed to 3.16.x for inclusion in 3.16.1. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org