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

(-)a/t/db_dependent/ILSDI_Services.t (-2 / +59 lines)
Lines 17-25 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use C4::Biblio qw( AddBiblio );
21
use C4::Items qw( AddItem );
22
use C4::Reserves qw( AddReserve GetReserve );
20
use CGI qw ( -utf8 );
23
use CGI qw ( -utf8 );
24
use MARC::Record;
21
25
22
use Test::More tests => 3;
26
use Test::More tests => 4;
23
use t::lib::Mocks;
27
use t::lib::Mocks;
24
use t::lib::TestBuilder;
28
use t::lib::TestBuilder;
25
29
Lines 191-194 subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes Link Here
191
    $schema->storage->txn_rollback;
195
    $schema->storage->txn_rollback;
192
};
196
};
193
197
198
199
subtest 'GetRecords' => sub {
200
201
    plan tests => 1;
202
203
    $schema->storage->txn_begin;
204
205
    t::lib::Mocks::mock_preference('ILS-DI', 1);
206
207
    my $builder = t::lib::TestBuilder->new;
208
209
    my $branch = $builder->build({
210
        source => 'Branch',
211
        value => {
212
            branchcode => 'T_ILSDI',
213
        }
214
    });
215
216
    my $category = $builder->build({
217
        source => 'Category',
218
        value  => {
219
            category_type => 'A',
220
        }
221
    });
222
223
    # Create a new user:
224
    my $borrower = $builder->build({
225
        source => 'Borrower',
226
        value  => {
227
            categorycode => $category->{categorycode},
228
            branchcode   => $branch->{branchcode},
229
        }
230
    });
231
232
    my ($biblionumber) = AddBiblio(MARC::Record->new, '');
233
    my $item = {};
234
    my $itemnumber = AddItem($item, $biblionumber);
235
236
    my $reserve_id = AddReserve($branch, $borrower->{borrowernumber}, $biblionumber);
237
238
    # Prepare and send web request for IL-SDI server:
239
    my $query = new CGI;
240
    $query->param( 'service', 'GetRecords' );
241
    $query->param( 'id', $biblionumber );
242
243
    my $response = C4::ILSDI::Services::GetRecords( $query );
244
245
    my $reserve = GetReserve($reserve_id);
246
    $reserve->{rtimestamp} = $reserve->{timestamp};
247
248
    is_deeply( $response->{record}->[0]->{reserves}->{reserve}, [ $reserve ],
249
        'GetRecords /record/reserves/reserve is as expected' );
250
};
251
194
1;
252
1;
195
- 

Return to bug 16246