From 87ee59649506125db0bd72b34e0515d7689b98d1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 24 Jan 2020 09:44:04 +0100 Subject: [PATCH] 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. --- t/db_dependent/TestBuilder.t | 2 +- t/lib/TestBuilder.pm | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/t/db_dependent/TestBuilder.t b/t/db_dependent/TestBuilder.t index 593a596e09..0050463e34 100644 --- a/t/db_dependent/TestBuilder.t +++ b/t/db_dependent/TestBuilder.t @@ -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" ); } diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm index cceacc1257..fd25f44a30 100644 --- a/t/lib/TestBuilder.pm +++ b/t/lib/TestBuilder.pm @@ -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; -- 2.11.0