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 Test::MockModule;
27
use Test::MockModule;
24
use t::lib::Mocks;
28
use t::lib::Mocks;
25
use t::lib::TestBuilder;
29
use t::lib::TestBuilder;
Lines 198-201 subtest 'GetPatronInfo/GetBorrowerAttributes test for extended patron attributes Link Here
198
    $schema->storage->txn_rollback;
202
    $schema->storage->txn_rollback;
199
};
203
};
200
204
205
206
subtest 'GetRecords' => sub {
207
208
    plan tests => 1;
209
210
    $schema->storage->txn_begin;
211
212
    t::lib::Mocks::mock_preference('ILS-DI', 1);
213
214
    my $builder = t::lib::TestBuilder->new;
215
216
    my $branch = $builder->build({
217
        source => 'Branch',
218
        value => {
219
            branchcode => 'T_ILSDI',
220
        }
221
    });
222
223
    my $category = $builder->build({
224
        source => 'Category',
225
        value  => {
226
            category_type => 'A',
227
        }
228
    });
229
230
    # Create a new user:
231
    my $borrower = $builder->build({
232
        source => 'Borrower',
233
        value  => {
234
            categorycode => $category->{categorycode},
235
            branchcode   => $branch->{branchcode},
236
        }
237
    });
238
239
    my ($biblionumber) = AddBiblio(MARC::Record->new, '');
240
    my $item = {};
241
    my $itemnumber = AddItem($item, $biblionumber);
242
243
    my $reserve_id = AddReserve($branch, $borrower->{borrowernumber}, $biblionumber);
244
245
    # Prepare and send web request for IL-SDI server:
246
    my $query = new CGI;
247
    $query->param( 'service', 'GetRecords' );
248
    $query->param( 'id', $biblionumber );
249
250
    my $response = C4::ILSDI::Services::GetRecords( $query );
251
252
    my $reserve = GetReserve($reserve_id);
253
    $reserve->{rtimestamp} = $reserve->{timestamp};
254
255
    is_deeply( $response->{record}->[0]->{reserves}->{reserve}, [ $reserve ],
256
        'GetRecords /record/reserves/reserve is as expected' );
257
};
258
201
1;
259
1;
202
- 

Return to bug 16246