From 3c047a331c6f0ed1edd03d39a7d72937f5cdbcb9 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 4 Nov 2016 13:49:57 +0000 Subject: [PATCH] Bug 17552: Continue revert and add tests to highlight the problem --- Koha/Objects.pm | 4 ++-- t/db_dependent/Koha/Objects.t | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index da2f2c9..56f165c 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -292,14 +292,14 @@ The autoload method is used call DBIx::Class method on a resultset. Important: If you plan to use one of the DBIx::Class methods you must provide relevant tests in t/db_dependent/Koha/Objects.t -Currently count, pager, reset, update and delete are covered. +Currently count, pager, update and delete are covered. =cut sub AUTOLOAD { my ( $self, @params ) = @_; - my @known_methods = qw( count pager reset update delete result_class ); + my @known_methods = qw( count pager update delete result_class ); my $method = our $AUTOLOAD; $method =~ s/.*:://; diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index de36f54..84b1a86 100644 --- a/t/db_dependent/Koha/Objects.t +++ b/t/db_dependent/Koha/Objects.t @@ -64,11 +64,13 @@ subtest 'pager' => sub { }; subtest 'reset' => sub { - plan tests => 1; + plan tests => 3; my $patrons = Koha::Patrons->search; my $first_borrowernumber = $patrons->next->borrowernumber; my $second_borrowernumber = $patrons->next->borrowernumber; + is( ref( $patrons->reset ), 'Koha::Patrons', 'Koha::Objects->reset should allow chaining' ); + is( ref( $patrons->reset->next ), 'Koha::Patron', 'Koha::Objects->reset should allow chaining' ); is( $patrons->reset->next->borrowernumber, $first_borrowernumber, 'Koha::Objects->reset should work as expected'); }; -- 2.1.4