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

(-)a/Koha/Objects.pm (+15 lines)
Lines 335-340 sub attributes_from_api { Link Here
335
    return $self->{_singular_object}->attributes_from_api( $attributes );
335
    return $self->{_singular_object}->attributes_from_api( $attributes );
336
}
336
}
337
337
338
=head3 from_api_mapping
339
340
    my $mapped_attributes_hash = $objects->from_api_mapping;
341
342
Attributes map from the API to DBIC
343
344
=cut
345
346
sub from_api_mapping {
347
    my ( $self ) = @_;
348
349
    $self->{_singular_object} ||= $self->object_class->new();
350
    return $self->{_singular_object}->from_api_mapping;
351
}
352
338
=head3 Koha::Objects->_wrap
353
=head3 Koha::Objects->_wrap
339
354
340
wraps the DBIC object in a corresponding Koha object
355
wraps the DBIC object in a corresponding Koha object
(-)a/t/db_dependent/Koha/Objects.t (-2 / +18 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 19;
22
use Test::More tests => 20;
23
use Test::Exception;
23
use Test::Exception;
24
use Test::Warn;
24
use Test::Warn;
25
25
Lines 760-762 subtest "attributes_from_api() tests" => sub { Link Here
760
760
761
    $schema->storage->txn_rollback;
761
    $schema->storage->txn_rollback;
762
};
762
};
763
- 
763
764
subtest "from_api_mapping() tests" => sub {
765
766
    plan tests => 1;
767
768
    $schema->storage->txn_begin;
769
770
    my $cities_rs = Koha::Cities->new;
771
    my $city      = Koha::City->new;
772
773
    is_deeply(
774
        $cities_rs->from_api_mapping,
775
        $city->from_api_mapping
776
    );
777
778
    $schema->storage->txn_rollback;
779
};

Return to bug 24432