Unit tests for Add*, Get* and Del* routines in C4::Circulation.pm
Created attachment 20689 [details] [review] Bug 10683: CRUD routines in C4::Circulation need unit tests This patch adds some unit tests wrap in a transaction for C4::Circulation.pm. Circulation_Branch.t adds tests for routines which deal with branch_item_rules,branch_borrower_circ_rules, default_branch_circ_rules, default_circ_rules, default_branch_item_rules in the database. Circulation_issue.t adds tests for routines which deal with accountline and issues in the database. NOTE: Some commented tests have to be fixed, and some tests can be added.More, other routines of Circulation.pm are tested in the patches: 10692 UT: Routines about transfers in Circulation.pm need unit tests 10710 UT : OfflineOperation's routines in C4/Circulation.t need unit tests 10767 UT: Routines which interact with the table issuingrules in C4/Circulation need unit test Test plan: prove t/db_dependent/Circulation_issue.t t/db_dependent/Circulation_issue.t .. ok All tests successful. Files=1, Tests=16, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.40 cusr 0.02 csys = 0.44 CPU) Result: PASS prove t/db_dependent/Circulation_Branch.t t/db_dependent/Circulation_Branch.t .. ok All tests successful. Files=1, Tests=10, 2 wallclock secs ( 0.06 usr 0.00 sys + 1.02 cusr 0.06 csys = 1.14 CPU) Result: PASS
Created attachment 20747 [details] [review] [SIGNED-OFF] Bug 10683: CRUD routines in C4::Circulation need unit tests This patch adds some unit tests wrap in a transaction for C4::Circulation.pm. Circulation_Branch.t adds tests for routines which deal with branch_item_rules,branch_borrower_circ_rules, default_branch_circ_rules, default_circ_rules, default_branch_item_rules in the database. Circulation_issue.t adds tests for routines which deal with accountline and issues in the database. NOTE: Some commented tests have to be fixed, and some tests can be added.More, other routines of Circulation.pm are tested in the patches: 10692 UT: Routines about transfers in Circulation.pm need unit tests 10710 UT : OfflineOperation's routines in C4/Circulation.t need unit tests 10767 UT: Routines which interact with the table issuingrules in C4/Circulation need unit test Test plan: prove t/db_dependent/Circulation_issue.t t/db_dependent/Circulation_issue.t .. ok All tests successful. Files=1, Tests=16, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.40 cusr 0.02 csys = 0.44 CPU) Result: PASS prove t/db_dependent/Circulation_Branch.t t/db_dependent/Circulation_Branch.t .. ok All tests successful. Files=1, Tests=10, 2 wallclock secs ( 0.06 usr 0.00 sys + 1.02 cusr 0.06 csys = 1.14 CPU) Result: PASS Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Well, I don't know exactly what to do with this, so I left it to QA a) prove t/db_dependent/Circulation_Branch.t works well and without erros b) prove t/db_dependent/Circulation_issue.t works without errors for me ONLY if I have a issuingrule for All, All with 1 as renewals allowed, in other cases it fails. No koha-qa errors
Created attachment 21241 [details] [review] Bug 10683: CRUD routines in C4::Circulation need unit tests This patch adds some unit tests wrap in a transaction for C4::Circulation.pm. Circulation_Branch.t adds tests for routines which deal with branch_item_rules,branch_borrower_circ_rules, default_branch_circ_rules, default_circ_rules, default_branch_item_rules in the database. Circulation_issue.t adds tests for routines which deal with accountline and issues in the database. NOTE: Some commented tests have to be fixed, and some tests can be added.More, other routines of Circulation.pm are tested in the patches: 10692 UT: Routines about transfers in Circulation.pm need unit tests 10710 UT : OfflineOperation's routines in C4/Circulation.t need unit tests 10767 UT: Routines which interact with the table issuingrules in C4/Circulation need unit test Test plan: prove t/db_dependent/Circulation_issue.t t/db_dependent/Circulation_issue.t .. ok All tests successful. Files=1, Tests=16, 0 wallclock secs ( 0.02 usr 0.00 sys + 0.40 cusr 0.02 csys = 0.44 CPU) Result: PASS prove t/db_dependent/Circulation_Branch.t t/db_dependent/Circulation_Branch.t .. ok All tests successful. Files=1, Tests=10, 2 wallclock secs ( 0.06 usr 0.00 sys + 1.02 cusr 0.06 csys = 1.14 CPU) Result: PASS Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Comment: Well, I don't know exactly what to do with this, so I left it to QA a) prove t/db_dependent/Circulation_Branch.t works well and without erros b) prove t/db_dependent/Circulation_issue.t works without errors for me ONLY if I have a issuingrule for All, All with 1 as renewals allowed, in other cases it fails. No koha-qa errors Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 21243 [details] [review] Bug 7791 : Give the ability to delete records when deleting a basket Currently, when a basket is deleted, all the orders are deleted (there is a foreign key in aqorders table on basketno). This could be dangerous, and there is no warn. After the deletion, unused biblios are left in the catalogue. This patch - adds a more detailed message describing the consequences of deletion - give the choice of also deleting biblio records if possible To test : Test A : 1. create a basket with 4 orders: - an order from a new record A - an order from a record B which has already an item - an order from a record C used in a subscription - an order from a record D used in an other order 2. note the biblionumbers of the records used (or open them in other tabs in yout browser) 3. click on "Delete basket" 4. choose button "Delete basket and orders" 5. check the catalogue : records A,B,C,D must still be there Test B: 1. create a basket with 4 orders: - an order from a new record A - an order from a record B which has already an item - an order from a record C used in a subscription - an order from a record D used in an other order 2. note the biblionumbers of the records used (or open them in other tabs in yout browser) 3. click on "Delete basket" 4. choose button "Delete basket, orders and records" 5. check the catalogue : records B,C,D must still be there. Record A must be deleted
Created attachment 21244 [details] [review] Bug 10683: Followup CRUD routines in C4::Circulation need unit tests The borrowers table needs to be cleared after the items table (last_returned_by column). Some checks were missing for GetRenewCount and AddRenewal. Now the tests simulated a renewal for a item and check that the renews left is decremented. Moreover the issuingrules tables should be cleared and filled with known values. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Pushed to master. Thanks, Kenza!