Tests on line 75 and 81 can sometimes, the failing line is: is( dt_from_string($b1_new->updated_on), dt_from_string, "borrowers.updated_on should have been set to now on creating" ); And the problem could more often happen on slower machines... We are testing the date and time of updated_on, but creating the test patrons, retrieving tested patron and test itself definitely takes some (short) time... which sometimes can be on the edge of a second and you can see this: # Failed test 'borrowers.updated_on should have been set to now on creating' # at t/db_dependent/Patrons.t line 75. # got: '2016-12-06T20:44:25' # expected: '2016-12-06T20:44:26' and also, the both tests on line 75 and 81 are the same, which is not intended I think...
Created attachment 58033 [details] [review] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Changes test #7 to the one which was probably originally intended Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff
Created attachment 58085 [details] [review] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Changes test #7 to the one which was probably originally intended Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff Signed-off-by: Chris Kirby <chris.kirby@ilsleypubliclibrary.org> Tests passed.
(In reply to Chris Kirby from comment #2) > Changes test #7 to the one which was probably originally intended No, the original test was good. We want to check that the updated_on value has been updated when a patron is modified.
(In reply to Jonathan Druart from comment #3) > (In reply to Chris Kirby from comment #2) > > Changes test #7 to the one which was probably originally intended > > No, the original test was good. We want to check that the updated_on value > has been updated when a patron is modified. But shouldn't it be tested on $b3_new?
(In reply to Josef Moravec from comment #4) > (In reply to Jonathan Druart from comment #3) > > (In reply to Chris Kirby from comment #2) > > > Changes test #7 to the one which was probably originally intended > > > > No, the original test was good. We want to check that the updated_on value > > has been updated when a patron is modified. > > But shouldn't it be tested on $b3_new? Yes it should.
Created attachment 58148 [details] [review] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Fixes test 7 Use Koha::Database instead of C4::Context->dbh Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff Signed-off-by: Chris Kirby <chris.kirby@ilsleypubliclibrary.org> Tests passed.
(In reply to Jonathan Druart from comment #3) > (In reply to Chris Kirby from comment #2) > > Changes test #7 to the one which was probably originally intended > > No, the original test was good. We want to check that the updated_on value > has been updated when a patron is modified. I change the back to original test, fix it (I hope), now it's tested on firstname, instead of surname, which is needed in later test... and maked the tests use Koha::Database instead of C4:Context->dbh;
Created attachment 58150 [details] [review] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Fixes test 7 Use Koha::Database instead of C4::Context->dbh Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff
Created attachment 58460 [details] [review] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Fixes test 7 Use Koha::Database instead of C4::Context->dbh Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff NOTE: Only minor improvement could be using test builder to generate the category and branch codes, rather than assume data exists. However, that is beyond scope of this bug. Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Created attachment 58462 [details] [review] Bug 17742: Fix t/db_dependent/Patrons.t Moves the getting of testing date for updated_on just after the storing the test patron data to make the gap between generating data and now date as short as possible Fixes test 7 Use Koha::Database instead of C4::Context->dbh Test plan 1. prove t/db_dependent/Patrons.t 2. read the diff NOTE: Only minor improvement could be using test builder to generate the category and branch codes, rather than assume data exists. However, that is beyond scope of this bug. Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Created attachment 58463 [details] [review] Bug 17742: Use TestBuilder to create the library and patron category Moreover we do not need to remove the existing issues and patrons Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Pushed to master for 17.05, thanks Josef, Jonathan!
These patches have been pushed to 16.11.x and will be in 16.11.02.
Pushed to 16.05.x, for 16.05.08 release