Bug 10683 - CRUD routines in C4::Circulation need unit tests
Summary: CRUD routines in C4::Circulation need unit tests
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: kenza
QA Contact: Testopia
URL:
Keywords:
Depends on: 10681
Blocks: 10795
  Show dependency treegraph
 
Reported: 2013-08-05 10:04 UTC by kenza
Modified: 2014-12-07 20:02 UTC (History)
4 users (show)

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


Attachments
Bug 10683: CRUD routines in C4::Circulation need unit tests (18.14 KB, patch)
2013-08-28 08:26 UTC, kenza
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 10683: CRUD routines in C4::Circulation need unit tests (18.54 KB, patch)
2013-08-31 02:13 UTC, Bernardo Gonzalez Kriegel
Details | Diff | Splinter Review
Bug 10683: CRUD routines in C4::Circulation need unit tests (18.59 KB, patch)
2013-09-19 14:26 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 7791 : Give the ability to delete records when deleting a basket (8.13 KB, patch)
2013-09-19 14:29 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 10683: Followup CRUD routines in C4::Circulation need unit tests (9.54 KB, patch)
2013-09-19 14:29 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description kenza 2013-08-05 10:04:28 UTC
Unit tests for Add*, Get* and Del* routines in C4::Circulation.pm
Comment 1 kenza 2013-08-28 08:26:48 UTC Comment hidden (obsolete)
Comment 2 Bernardo Gonzalez Kriegel 2013-08-31 02:13:37 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2013-09-19 14:26:44 UTC
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>
Comment 4 Jonathan Druart 2013-09-19 14:29:09 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2013-09-19 14:29:56 UTC
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>
Comment 6 Galen Charlton 2013-10-09 03:59:55 UTC
Pushed to master.  Thanks, Kenza!