Bug 23825: (QA follow-up) Remove database name

As requested on comment15.

Test plan:
Run t/db_dependent/Koha/Object.t again

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Marcel de Rooy 2019-10-28 09:00:26 +00:00 committed by Martin Renvoize
parent 6a2c5d665e
commit e5cdf88544
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 9 additions and 6 deletions

View File

@ -174,12 +174,15 @@ sub store {
duplicate_id => $+{key}
);
}
elsif( $_->{msg} =~ /Incorrect (?<type>\w+) value: '(?<value>.*)' for column \W?(?<property>\S+)/ ) {
# The optional \W in the regex might be a quote or backtick
elsif( $_->{msg} =~ /Incorrect (?<type>\w+) value: '(?<value>.*)' for column \W?(?<property>\S+)/ ) { # The optional \W in the regex might be a quote or backtick
my $type = $+{type};
my $value = $+{value};
my $property = $+{property};
$property =~ s/['`]//g;
Koha::Exceptions::Object::BadValue->throw(
type => $+{type},
value => $+{value},
property => $+{property},
type => $type,
value => $value,
property => $property =~ /(\w+\.\w+)$/ ? $1 : $property, # results in table.column without quotes or backtics
);
}
}

View File

@ -410,7 +410,7 @@ subtest 'store() tests' => sub {
$patron->lastseen('wrong_value')->store;
} catch {
ok( $_->isa('Koha::Exceptions::Object::BadValue'), 'Exception thrown correctly' );
like( $_->property, qr/borrowers\W?\.\W?lastseen/, 'Column should be the expected one' ); # optional \W for quote or backtic
like( $_->property, qr/borrowers\.lastseen/, 'Column should be the expected one' );
is( $_->value, 'wrong_value', 'Value should be the expected one' );
};