Bug 24149: Skip Koha::Statistics for TestBuilder tests

As statistics does not have a PK we need to adjust the TestBuilder
tests.
Bug 18441 already exists for adding the PK.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Jonathan Druart 2020-01-24 09:44:04 +01:00 committed by Martin Renvoize
parent 9597a384f3
commit 88d699fece
No known key found for this signature in database
GPG Key ID: 422B469130441A0F
2 changed files with 3 additions and 1 deletions

View File

@ -395,7 +395,7 @@ subtest 'build_object() tests' => sub {
eval "require $module";
my $object = $builder->build_object( { class => $module } );
is( ref($object), $module->object_class, "Testing $module" );
if ( $module ne 'Koha::Old::Patrons' ) { # FIXME deletedborrowers does not have a PK
if ( ! grep {$module eq $_ } qw( Koha::Old::Patrons Koha::Statistics ) ) { # FIXME deletedborrowers and statistics do not have a PK
eval {$object->get_from_storage};
is( $@, '', "Module $module should have koha_object[s]_class method if needed" );
}

View File

@ -86,6 +86,8 @@ sub build_object {
my $object;
if ( $class eq 'Koha::Old::Patrons' ) {
$object = $class->search({ borrowernumber => $hashref->{borrowernumber} })->next;
} elsif ( $class eq 'Koha::Statistics' ) {
$object = $class->search({ datetime => $hashref->{datetime} })->next;
} else {
my @ids;
my @pks = $self->schema->source( $class->_type )->primary_columns;