Bug 21618 - side-effects with timestamp columns with Test::DBIx::Class
Summary: side-effects with timestamp columns with Test::DBIx::Class
Status: RESOLVED DUPLICATE of bug 21610
Alias: None
Product: Koha
Classification: Unclassified
Component: Test Suite (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major
Assignee: Chris Cormack
QA Contact: Testopia
URL:
Keywords:
Depends on: 21596
Blocks:
  Show dependency treegraph
 
Reported: 2018-10-19 10:46 UTC by Jonathan Druart
Modified: 2018-10-19 11:02 UTC (History)
0 users

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2018-10-19 10:46:29 UTC
Since
  commit 5024cb3acffdfb9f67dce5587eb062ea3130bdbb
  Bug 21596: Handle empty string for other attributes when storing a patron

There is a failure from t/Auth_with_shibboleth.t:
DBI Exception: DBD::SQLite::st execute failed: NOT NULL constraint failed: borrowers.updated_on
Comment 1 Jonathan Druart 2018-10-19 10:49:06 UTC
I have isolated the issue with this code. I do not understand why the default value (CURRENT_TIMESTAMP) is not picked.

#!/usr/bin/perl

use Modern::Perl;

use Test::MockModule;

use Koha::Patrons;
use Koha::Patron::Categories;

use Test::DBIx::Class {
    schema_class => 'Koha::Schema',
    connect_info => [ 'dbi:SQLite:dbname=:memory:', '', '' ]
};

my $database = Test::MockModule->new('Koha::Database');
$database->mock(
    _new_schema => sub { return Schema(); }
);

Koha::Patron::Category->new({categorycode => 'S'})->store;
my $borrower = { 
    categorycode => 'S',
    userid => 'test4321',
};
my $patron = Koha::Patron->new( $borrower )->store;
Comment 2 Jonathan Druart 2018-10-19 11:02:38 UTC
Fixed by Marcel's patch on bug 21610 comment 10

*** This bug has been marked as a duplicate of bug 21610 ***