Lines 399-415
subtest 'store() tests' => sub {
Link Here
|
399 |
|
399 |
|
400 |
subtest 'Bad value tests' => sub { |
400 |
subtest 'Bad value tests' => sub { |
401 |
|
401 |
|
402 |
plan tests => 1; |
402 |
plan tests => 3; |
403 |
|
403 |
|
404 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
404 |
my $patron = $builder->build_object({ class => 'Koha::Patrons' }); |
405 |
|
405 |
|
406 |
my $print_error = $schema->storage->dbh->{PrintError}; |
406 |
my $print_error = $schema->storage->dbh->{PrintError}; |
407 |
$schema->storage->dbh->{PrintError} = 0; |
407 |
$schema->storage->dbh->{PrintError} = 0; |
408 |
|
408 |
|
409 |
throws_ok |
409 |
try { |
410 |
{ $patron->lastseen('wrong_value')->store; } |
410 |
$patron->lastseen('wrong_value')->store; |
411 |
'Koha::Exceptions::Object::BadValue', |
411 |
} catch { |
412 |
'Exception thrown correctly'; |
412 |
ok( $_->isa('Koha::Exceptions::Object::BadValue'), 'Exception thrown correctly' ); |
|
|
413 |
is( $_->property, 'borrowers.lastseen', 'Column should be the expected one' ); |
414 |
is( $_->value, 'wrong_value', 'Value should be the expected one' ); |
415 |
}; |
413 |
|
416 |
|
414 |
$schema->storage->dbh->{PrintError} = $print_error; |
417 |
$schema->storage->dbh->{PrintError} = $print_error; |
415 |
}; |
418 |
}; |
416 |
- |
|
|