Bug 17552: Continue revert and add tests to highlight the problem
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 4 Nov 2016 13:49:57 +0000 (13:49 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 7 Nov 2016 16:39:43 +0000 (16:39 +0000)
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Objects.pm
t/db_dependent/Koha/Objects.t

index da2f2c9..56f165c 100644 (file)
@@ -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/.*:://;
 
index de36f54..84b1a86 100644 (file)
@@ -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');
 };