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

(-)a/t/db_dependent/XSLT.t (-2 / +49 lines)
Lines 21-27 use File::Temp; Link Here
21
use File::Path qw/make_path/;
21
use File::Path qw/make_path/;
22
use MARC::Record;
22
use MARC::Record;
23
use Test::NoWarnings;
23
use Test::NoWarnings;
24
use Test::More tests => 5;
24
use Test::More tests => 6;
25
use Test::Warn;
25
use Test::Warn;
26
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
27
use t::lib::Mocks;
27
use t::lib::Mocks;
Lines 308-310 subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub { Link Here
308
308
309
    $schema->storage->txn_rollback;
309
    $schema->storage->txn_rollback;
310
};
310
};
311
- 
311
312
subtest 'buildKohaItemsNamespace() EasyAnalyticalRecords items' => sub {
313
    plan tests => 3;
314
315
    $schema->storage->txn_begin;
316
317
    t::lib::Mocks::mock_preference( 'marcflavour', 'MARC21' );
318
319
    my $library      = $builder->build_object( { class => 'Koha::Libraries' } );
320
    my $library_name = $library->branchname;
321
322
    my $biblio1 = $builder->build_sample_biblio;
323
    my $biblio2 = $builder->build_sample_biblio;
324
325
    my $item_1 = $builder->build_sample_item( { biblionumber => $biblio1->biblionumber, library => $library->id } );
326
327
    my $marc2 = $biblio2->metadata->record;
328
    $marc2->insert_fields_ordered(
329
        MARC::Field->new(
330
            '773', '0', ' ',
331
            0 => $biblio1->biblionumber,
332
            9 => $item_1->itemnumber
333
        )
334
    );
335
    C4::Biblio::ModBiblio( $marc2, $biblio2->biblionumber, '' );
336
337
    t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords', '0' );
338
    my $xml = C4::XSLT::buildKohaItemsNamespace( $biblio2->biblionumber, undef, undef );
339
    is(
340
        $xml, '<items xmlns="http://www.koha-community.org/items"></items>',
341
        'Empty XML'
342
    );
343
344
    t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords', '1' );
345
    $xml = C4::XSLT::buildKohaItemsNamespace( $biblio2->biblionumber, undef, undef );
346
    isnt(
347
        $xml,
348
        '<items xmlns="http://www.koha-community.org/items"></items>',
349
        'Items present'
350
    );
351
    like(
352
        $xml,
353
        qr{<homebranch>$library_name</homebranch>},
354
        '$item_1 present in the XML'
355
    );
356
357
    $schema->storage->txn_rollback;
358
};

Return to bug 41982