]> git.koha-community.org Git - koha.git/commit
Bug 19405: Prevent api/v1/holds.t to fail randomly
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 3 Oct 2017 22:20:18 +0000 (19:20 -0300)
committerFridolin Somers <fridolin.somers@biblibre.com>
Fri, 27 Oct 2017 13:08:20 +0000 (15:08 +0200)
commit6d90376e7b75f27a6a0b33e01efa04da68c18a9a
tree5c11efa70448a5d6dc439b38b80777fe58190ba0
parentec06d9daa836005470c47d40ec2eba8d86910895
Bug 19405: Prevent api/v1/holds.t to fail randomly

DBD::mysql::st execute failed: Duplicate entry 'cEMggO40gdPLhcVXbpry8x0izO8lHr8NafFIBJwm0D1HgiXA57YR0a0VVxhQBzvn' for key 'userid' [for Statement "INSERT INTO `borrowers` ( `branchcode`, `categorycode`, `flags`, `surname`, `userid`) VALUES ( ?, ?, ?, ?, ? )" with ParamValues: 0='N2ElsY9', 1='Kk8G', 2=80, 3='Test Surname', 4='cEMggO40gdPLhcVXbpry8x0izO8lHr8NafFIBJwm0D1HgiXA57YR0a0VVxhQBzvnnbgezJqmxqwz'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832.
DBIx::Class::Storage::DBI::_dbh_execute(): Duplicate entry 'cEMggO40gdPLhcVXbpry8x0izO8lHr8NafFIBJwm0D1HgiXA57YR0a0VVxhQBzvn' for key 'userid' at /kohadevbox/koha/Koha/Object.pm line 121
[18:52:19] t/db_dependent/api/v1/holds.t

Reading the code I guess it happens if TestBuilder generates a userid with the size of borrowers.userid (75 chars). In that case the following lines are wrong:

$borrower->userid($nopermission->{ userid }."z");
$borrower2->userid($nopermission->{ userid }."x");
$borrower3->userid($nopermission->{ userid }."y");

The 3 patrons will have the same userid.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit a1bf319829c9d44991daa2fcf2593420f8445c5b)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
t/db_dependent/api/v1/holds.t