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

(-)a/Koha/Acquisition/Order.pm (-1 / +1 lines)
Lines 109-115 Returns the basket associated to the order. Link Here
109
109
110
sub basket {
110
sub basket {
111
    my ( $self )  = @_;
111
    my ( $self )  = @_;
112
    return Koha::Acquisition::Baskets->find( $self->{basketno} );
112
    return Koha::Acquisition::Baskets->find( $self->basketno );
113
}
113
}
114
114
115
=head2 Internal methods
115
=head2 Internal methods
(-)a/t/db_dependent/Koha/Acquisition/Order.t (-1 / +57 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2017 Koha Development team
4
#
5
# This file is part of Koha
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Test::More tests => 1;
23
24
use t::lib::TestBuilder;
25
use t::lib::Mocks;
26
27
use Koha::Database;
28
29
my $schema  = Koha::Database->schema;
30
my $builder = t::lib::TestBuilder->new;
31
32
subtest 'basket() tests' => sub {
33
34
    plan tests => 2;
35
36
    $schema->storage->txn_begin;
37
38
    my $basket = $builder->build_object(
39
        {
40
            class => 'Koha::Acquisition::Baskets'
41
        }
42
    );
43
    my $order = $builder->build_object(
44
        {
45
            class => 'Koha::Acquisition::Orders',
46
            value => { basketno => $basket->basketno }
47
        }
48
    );
49
50
    my $retrieved_basket = $order->basket;
51
    is( ref($retrieved_basket), 'Koha::Acquisition::Basket',
52
        'Type is correct for ->basket' );
53
    is_deeply( $retrieved_basket->unblessed,
54
        $basket->unblessed, "Correct basket found and updated" );
55
56
    $schema->storage->txn_rollback;
57
};

Return to bug 15685