@@ -, +, @@ of AUTOLOAD in Koha::Objects --- Koha/Objects.pm | 2 ++ t/db_dependent/Koha/Objects.t | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) --- a/Koha/Objects.pm +++ a/Koha/Objects.pm @@ -240,9 +240,11 @@ Currently count, pager, reset and update are covered. sub AUTOLOAD { my ( $self, @params ) = @_; + my @known_methods = qw( count pager reset update ); my $method = our $AUTOLOAD; $method =~ s/.*:://; + carp "The method $method is not covered by tests" and return unless grep {/^$method$/} @known_methods; my $r = eval { $self->_resultset->$method(@params) }; if ( $@ ) { carp "No method $method found for " . ref($self) . " " . $@; --- a/t/db_dependent/Koha/Objects.t +++ a/t/db_dependent/Koha/Objects.t @@ -19,7 +19,8 @@ use Modern::Perl; -use Test::More tests => 5; +use Test::More tests => 6; +use Test::Warn; use Koha::Authority::Types; use Koha::Cities; @@ -66,5 +67,10 @@ subtest 'reset' => sub { is( $patrons->reset->next->borrowernumber, $first_borrowernumber, 'Koha::Objects->reset should work as expected'); }; +subtest 'not_covered_yet' => sub { + plan tests => 1; + warning_is { Koha::Patrons->search->not_covered_yet } { carped => 'The method not_covered_yet is not covered by tests' }, "If a method is not covered by tests, the AUTOLOAD method won't execute the method"; +}; + $schema->storage->txn_rollback; 1; --