Bug 18093: Add Koha::Objects->get_column
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 10 Feb 2017 08:45:26 +0000 (09:45 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 3 Apr 2017 09:54:11 +0000 (09:54 +0000)
Test plan:
  prove t/db_dependent/Koha/Objects.t
Should return green

Followed test plan, result as expected
Signed-off-by: Marc VĂ©ron <veron@veron.ch>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Koha/Objects.pm
t/db_dependent/Koha/Objects.t

index 41fee35..7d0ae81 100644 (file)
@@ -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/.*:://;
 
index f1910da..44fda50 100644 (file)
@@ -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;