From 1eab22f71e27675a66e4f91522a0f422a3455e34 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 10 Feb 2017 09:45:26 +0100 Subject: [PATCH] Bug 18093: Add Koha::Objects->get_column MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Test plan: prove t/db_dependent/Koha/Objects.t Should return green Followed test plan, result as expected Signed-off-by: Marc Véron Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall --- Koha/Objects.pm | 2 +- t/db_dependent/Koha/Objects.t | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Koha/Objects.pm b/Koha/Objects.pm index 41fee3507e..7d0ae81ff7 100644 --- a/Koha/Objects.pm +++ b/Koha/Objects.pm @@ -359,7 +359,7 @@ Currently count, pager, update and delete are covered. sub AUTOLOAD { my ( $self, @params ) = @_; - my @known_methods = qw( count pager update delete result_class single slice ); + my @known_methods = qw( count pager update delete result_class single slice get_column ); my $method = our $AUTOLOAD; $method =~ s/.*:://; diff --git a/t/db_dependent/Koha/Objects.t b/t/db_dependent/Koha/Objects.t index f1910daf5b..44fda50a5b 100644 --- a/t/db_dependent/Koha/Objects.t +++ b/t/db_dependent/Koha/Objects.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::More tests => 12; +use Test::More tests => 13; use Test::Warn; use Koha::Authority::Types; @@ -140,6 +140,13 @@ subtest 'last' => sub { is( $last_patron, undef, '->last should return undef if search does not return any results' ); }; +subtest 'get_column' => sub { + plan tests => 1; + my @cities = Koha::Cities->search; + my @city_names = map { $_->city_name } @cities; + is_deeply( [ Koha::Cities->search->get_column('city_name')->all ], \@city_names, 'Koha::Objects->get_column should be allowed' ); +}; + subtest 'Exceptions' => sub { plan tests => 2; -- 2.39.5