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

(-)a/t/db_dependent/Koha/Biblio.t (-2 / +9 lines)
Lines 1387-1401 subtest 'host_items() tests' => sub { Link Here
1387
    is( $host_items->count, 0 );
1387
    is( $host_items->count, 0 );
1388
1388
1389
    subtest 'test host_items param in items()' => sub {
1389
    subtest 'test host_items param in items()' => sub {
1390
        plan tests => 4;
1390
        plan tests => 5;
1391
1392
        t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords', 1 );
1391
1393
1392
        my $items = $biblio->items;
1394
        my $items = $biblio->items;
1393
        is( $items->count, 1, "Without host_items param we only get the items on the biblio");
1395
        is( $items->count, 1, "Without host_items param we only get the items on the biblio");
1396
1394
        $items = $biblio->items({ host_items => 1 });
1397
        $items = $biblio->items({ host_items => 1 });
1395
        is( $items->count, 3, "With param host_items we get the biblio items plus analytics");
1398
        is( $items->count, 3, "With param host_items we get the biblio items plus analytics");
1396
        is( ref($items), 'Koha::Items', "We correctly get an Items object");
1399
        is( ref($items), 'Koha::Items', "We correctly get an Items object");
1397
        is_deeply( [ $items->get_column('itemnumber') ],
1400
        is_deeply( [ $items->get_column('itemnumber') ],
1398
            [ $item_1->itemnumber, $host_item_1->itemnumber, $host_item_2->itemnumber ] );
1401
            [ $item_1->itemnumber, $host_item_1->itemnumber, $host_item_2->itemnumber ] );
1402
1403
        t::lib::Mocks::mock_preference( 'EasyAnalyticalRecords', 0 );
1404
1405
        $items = $biblio->items({ host_items => 1 });
1406
        is( $items->count, 1, "With host_items param but EasyAnalyticalRecords disabled we only get the items on the biblio");
1399
    };
1407
    };
1400
1408
1401
    $schema->storage->txn_rollback;
1409
    $schema->storage->txn_rollback;
1402
- 

Return to bug 37964