Bug 14878 - Tests - Create the branchcodes if needed
Summary: Tests - Create the branchcodes if needed
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 15081
Blocks: 10273 16390
  Show dependency treegraph
 
Reported: 2015-09-22 16:38 UTC by Jonathan Druart
Modified: 2016-12-05 21:27 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 14878: Tests - Create the branchcodes when needed (80.37 KB, patch)
2015-09-22 16:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14878: Tests - Create the branchcodes when needed (75.75 KB, patch)
2015-11-06 13:05 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 14878: Tests - Create the branchcodes when needed (75.81 KB, patch)
2015-11-06 17:50 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 14878: (QA followup) Remove useless diag (1.17 KB, patch)
2015-11-06 17:50 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
[PASSED QA] Bug 14878: Tests - Create the branchcodes when needed (75.90 KB, patch)
2015-11-06 18:51 UTC, Kyle M Hall
Details | Diff | Splinter Review
[PASSED QA] Bug 14878: (QA followup) Remove useless diag (1.24 KB, patch)
2015-11-06 18:51 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2015-09-22 16:38:55 UTC
Tests assume that the branchcodes CPL/MPL/etc. already exist in the DB.
If they need them, they should create them.
Comment 1 Jonathan Druart 2015-09-22 16:43:30 UTC Comment hidden (obsolete)
Comment 2 Alex Arnaud 2015-11-03 16:35:26 UTC
This patch is quite not esay to test because lot of things remain "db dependent".
Jonathan, i did the following (tell me if i'm wrong):

- I get the database content provided in bug 10337 (to satisfy all db dependent things),
- i created a branchcode 'FOO' on my database and change all borrowers branchcodes with this one,
- i deleted all other branches
- launch tests on all changed files and get errors on t/db_dependent/Members.t and 
t/db_dependent/Serials_2.t

t/db_dependent/Members.t: Failed test 'Member Changed' (Mismatching member details)
t/db_dependent/Serials_2.t: A mysql error
Comment 3 Tomás Cohen Arazi 2015-11-03 17:28:18 UTC
This one is in conflict with bug 15081, that aims to let the test files handle the transactions on their own.

I think the transaction should be started/rolled back when the test writer considers it needs to. An example: if we want each subtest to rollback when it finish, DBIx::Class will complain about nested transactions. And if it doesn't rollback explicitly there would be side effects between tests.
Comment 4 Jonathan Druart 2015-11-06 13:05:51 UTC Comment hidden (obsolete)
Comment 5 Jonathan Druart 2015-11-06 13:06:41 UTC
Conflicts with bug 15081 fixed.
Comment 6 Tomás Cohen Arazi 2015-11-06 17:50:38 UTC Comment hidden (obsolete)
Comment 7 Tomás Cohen Arazi 2015-11-06 17:50:44 UTC Comment hidden (obsolete)
Comment 8 Tomás Cohen Arazi 2015-11-06 17:51:19 UTC
Nice job Jonathan!
Comment 9 Kyle M Hall 2015-11-06 18:51:31 UTC
Created attachment 44601 [details] [review]
[PASSED QA] Bug 14878: Tests - Create the branchcodes when needed

Tests assume that the branchcodes CPL/MPL/etc. already exist in the DB.
If they need them, they should create them.

Test plan:
Execute the differente test files on a DB without any branchcode or
at least without CPL/MPL branches.
Confirm that the tests pass.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 10 Kyle M Hall 2015-11-06 18:51:42 UTC
Created attachment 44602 [details] [review]
[PASSED QA] Bug 14878: (QA followup) Remove useless diag

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 11 Tomás Cohen Arazi 2015-11-06 18:54:29 UTC
Patches pushed to master.

Thanks Jonathan!