Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 54; |
20 |
use Test::More tests => 53; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Exception; |
22 |
use Test::Exception; |
23 |
|
23 |
|
Lines 154-181
is( $borrower->{debarred}, '2042-01-01', 'Koha::Patron->store should correctly s
Link Here
|
154 |
is( $borrower->{dateexpiry}, '9999-12-31', 'Koha::Patron->store should correctly set dateexpiry if a valid date is given'); |
154 |
is( $borrower->{dateexpiry}, '9999-12-31', 'Koha::Patron->store should correctly set dateexpiry if a valid date is given'); |
155 |
is( $borrower->{dateenrolled}, '2015-09-06', 'Koha::Patron->store should correctly set dateenrolled if a valid date is given'); |
155 |
is( $borrower->{dateenrolled}, '2015-09-06', 'Koha::Patron->store should correctly set dateenrolled if a valid date is given'); |
156 |
|
156 |
|
157 |
subtest 'Koha::Patron->store should not update userid if not true' => sub { |
|
|
158 |
plan tests => 3; |
159 |
|
160 |
# TODO Move this to t/db_dependent/Koha/Patrons.t subtest ->store |
161 |
|
162 |
$data{ cardnumber } = "234567890"; |
163 |
$data{userid} = 'a_user_id'; |
164 |
$borrowernumber = Koha::Patron->new( \%data )->store->borrowernumber; |
165 |
my $patron = Koha::Patrons->find( $borrowernumber ); |
166 |
my $borrower = $patron->unblessed; |
167 |
|
168 |
$patron->set( { firstname => 'Tomas', userid => '' } )->store; |
169 |
$borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
170 |
is ( $borrower->{userid}, $data{userid}, 'Koha::Patron->store should not update the userid with an empty string' ); |
171 |
$patron->set( { firstname => 'Tomas', userid => 0 } )->store; |
172 |
$borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
173 |
is ( $borrower->{userid}, $data{userid}, 'Koha::Patron->store should not update the userid with an 0'); |
174 |
$patron->set( { firstname => 'Tomas', userid => undef } )->store; |
175 |
$borrower = Koha::Patrons->find( $borrowernumber )->unblessed; |
176 |
is ( $borrower->{userid}, $data{userid}, 'Koha::Patron->store should not update the userid with an undefined value'); |
177 |
}; |
178 |
|
179 |
#Regression tests for bug 10612 |
157 |
#Regression tests for bug 10612 |
180 |
my $library3 = $builder->build({ |
158 |
my $library3 = $builder->build({ |
181 |
source => 'Branch', |
159 |
source => 'Branch', |
182 |
- |
|
|