Bug 10386 - UT: VirtualShelves.t needs some more adjustments
Summary: UT: VirtualShelves.t needs some more adjustments
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Marcel de Rooy
QA Contact:
URL:
Keywords:
Depends on: 10290
Blocks:
  Show dependency treegraph
 
Reported: 2013-05-31 17:29 UTC by Marcel de Rooy
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 10386: VirtualShelves.t needs some more adjustments (10.52 KB, patch)
2013-06-10 12:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 10386: VirtualShelves.t needs some more adjustments (10.53 KB, patch)
2013-06-21 12:39 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 10386: VirtualShelves.t needs some more adjustments (10.58 KB, patch)
2013-06-28 10:18 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Marcel de Rooy 2013-05-31 17:29:13 UTC
Will build upon the changes proposed in bug 10290.
IMO this unit test should not just delete all records at the start. (Why ruin my test database for lazy programming :) ?
Furthermore, the unique name test for lists is not completely correct.
Will also add two small new tests for AddShare from bug 9032.
Note also that a test db may not even contain 10 borrowers..
And some room for more refinements, when working on it.
Comment 1 Galen Charlton 2013-06-03 14:37:51 UTC
(In reply to comment #0)
> IMO this unit test should not just delete all records at the start. (Why
> ruin my test database for lazy programming :) ?

Indeed.  I think a worthwhile goal would be for each DB-dependent test (or perhaps the DB-dependent test suite as a whole) to leave the database in essentially the same state it started in.
Comment 2 Marcel de Rooy 2013-06-10 12:52:38 UTC Comment hidden (obsolete)
Comment 3 Marcel de Rooy 2013-06-10 13:12:31 UTC
(In reply to comment #0)
> Will also add two small new tests for AddShare from bug 9032.

This patch does not depend on bug 9032.
The tests for AddShare are added on bug 10441.
Comment 4 Kyle M Hall 2013-06-21 12:39:19 UTC Comment hidden (obsolete)
Comment 5 Chris Cormack 2013-06-28 10:18:46 UTC
Created attachment 19273 [details] [review]
Bug 10386: VirtualShelves.t needs some more adjustments

Most important: Does no longer delete all shelves!
Checks if there are ten borrowers for testing. But even works without them :)
When creating or modifying lists, takes name clashes into consideration.

Small change to _CheckShelfName in VirtualShelves module. Making it possible to
check a name for a list whose owner has been set to NULL. Note that a test
like field=? with undef for placeholder will not work in MySql.

Test plan:
How do you test a test? Well, you could run it on various databases..
But for real hacking, you could also add some debug lines.
I tested this by forcing 10 undefs in @borrowernumbers.
And by overwriting the return value of randomname with an existing name.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Comment 6 Galen Charlton 2013-06-28 12:20:17 UTC
Pushed to master.  Thanks, Marcel!
Comment 7 Tomás Cohen Arazi 2013-07-15 18:08:59 UTC
This patch has been pushed to 3.12.x, will be in 3.12.2.

Thanks Marcel!
Comment 8 Bernardo Gonzalez Kriegel 2013-07-16 12:21:44 UTC
Pushed to 3.10.x, will be in 3.10.8
Comment 9 Chris Hall 2013-08-17 22:59:01 UTC
Pushed to 3.8.x, will be in 3.8.17