Bug 35042

Summary: Members.t: should not set datelastseen to NULL everywhere
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Test SuiteAssignee: Marcel de Rooy <m.de.rooy>
Status: Pushed to oldstable --- QA Contact: Katrin Fischer <katrin.fischer>
Severity: normal    
Priority: P5 - low CC: fridolin.somers
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.11.00,23.05.05,22.11.12
Attachments: Bug 35042: Remove set datelastseen to null on table in Members.t
Bug 35042: Remove set datelastseen to null on table in Members.t

Description Marcel de Rooy 2023-10-12 09:32:22 UTC
It can be tempting to remove all records from a table or just set one column to NULL in a whole table to get a test working quickly.

But we should better avoid that, or replace it by something less drastic (if reasonably possible).

An example from Members.t:

$dbh->do(q|UPDATE borrowers SET lastseen=NULL|);

Surely you should not run such tests on a production db. But when someone forgets a rollback here or there, you might have some troubled data on your test system, and often needless.
Note that I still often see test branches or item types appear in my test data after spending some time on a test db with master (running some tests).
Comment 1 Marcel de Rooy 2023-10-12 11:57:36 UTC
Created attachment 156954 [details] [review]
Bug 35042: Remove set datelastseen to null on table in Members.t

Non-trivial was adding the category_type <> S.

Test plan:
Run t/db_dependent/Members.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2023-10-12 11:58:32 UTC
Just run the test! Switching to SO
Comment 3 Katrin Fischer 2023-10-14 15:33:22 UTC
Created attachment 157153 [details] [review]
Bug 35042: Remove set datelastseen to null on table in Members.t

Non-trivial was adding the category_type <> S.

Test plan:
Run t/db_dependent/Members.t

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 4 Tomás Cohen Arazi 2023-10-18 13:23:41 UTC
Pushed to master for 23.11.

Nice work everyone, thanks!
Comment 5 Fridolin Somers 2023-10-25 07:14:53 UTC
Pushed to 23.05.x for 23.05.05
Comment 6 Matt Blenkinsop 2023-11-13 13:46:15 UTC
Nice work everyone!

Pushed to oldstable for 22.11.x