View | Details | Raw Unified | Return to bug 16889
Collapse All | Expand All

(-)a/Koha/Objects.pm (+15 lines)
Lines 254-259 sub _resultset { Link Here
254
    }
254
    }
255
}
255
}
256
256
257
=head3 columns
258
259
my @columns = Koha::Objects->columns
260
261
Return the table columns
262
263
=cut
264
265
sub columns {
266
    my ( $class ) = @_;
267
    return Koha::Database->new->schema->resultset( $class->_type )->result_source->columns;
268
}
269
270
271
257
=head3 _type
272
=head3 _type
258
273
259
The _type method must be set for all child classes.
274
The _type method must be set for all child classes.
(-)a/t/db_dependent/Koha/Objects.t (-2 / +6 lines)
Lines 19-27 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 1;
22
use Test::More tests => 2;
23
23
24
use Koha::Authority::Types;
24
use Koha::Authority::Types;
25
use Koha::Patrons;
25
use Koha::Database;
26
use Koha::Database;
26
27
27
use t::lib::TestBuilder;
28
use t::lib::TestBuilder;
Lines 31-35 $schema->storage->txn_begin; Link Here
31
32
32
is( ref(Koha::Authority::Types->find('')), 'Koha::Authority::Type', 'Koha::Objects->find should work if the primary key is an empty string' );
33
is( ref(Koha::Authority::Types->find('')), 'Koha::Authority::Type', 'Koha::Objects->find should work if the primary key is an empty string' );
33
34
35
my @columns = Koha::Patrons->columns;
36
my $borrowernumber_exists = grep { /^borrowernumber$/ } @columns;
37
is( $borrowernumber_exists, 1, 'Koha::Objects->columns should return the table columns' );
38
34
$schema->storage->txn_rollback;
39
$schema->storage->txn_rollback;
35
1;
40
1;
36
- 

Return to bug 16889