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

(-)a/t/db_dependent/Koha/Biblio.t (-1 / +36 lines)
Lines 17-23 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 11;
20
use Test::More tests => 12;
21
21
22
use C4::Biblio;
22
use C4::Biblio;
23
use Koha::Database;
23
use Koha::Database;
Lines 541-543 subtest 'orders() and active_orders_count() tests' => sub { Link Here
541
541
542
    $schema->storage->txn_rollback;
542
    $schema->storage->txn_rollback;
543
};
543
};
544
545
subtest 'subscriptions() and subscriptions_count() tests' => sub {
546
547
    plan tests => 6;
548
549
    $schema->storage->txn_begin;
550
551
    my $biblio = $builder->build_sample_biblio;
552
553
    my $subscriptions = $biblio->subscriptions;
554
    is( ref($subscriptions), 'Koha::Subscriptions',
555
        'Koha::Biblio->subscriptions should return a Koha::Subscriptions object'
556
    );
557
    is( $subscriptions->count, 0, 'Koha::Biblio->subscriptions should return the correct number of subscriptions');
558
    is( $biblio->subscriptions_count, 0, 'subscriptions_count returns the correct number' );
559
560
    # Add two subscriptions
561
    foreach (1..2) {
562
        $builder->build_object(
563
            {
564
                class => 'Koha::Subscriptions',
565
                value => { biblionumber => $biblio->biblionumber }
566
            }
567
        );
568
    }
569
570
    $subscriptions = $biblio->subscriptions;
571
    is( ref($subscriptions), 'Koha::Subscriptions',
572
        'Koha::Biblio->subscriptions should return a Koha::Subscriptions object'
573
    );
574
    is( $subscriptions->count, 2, 'Koha::Biblio->subscriptions should return the correct number of subscriptions');
575
    is( $biblio->subscriptions_count, 2, 'subscriptions_count returns the correct number' );
576
577
    $schema->storage->txn_rollback;
578
};
(-)a/t/db_dependent/Koha/Biblios.t (-18 / +1 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 6;
22
use Test::More tests => 5;
23
use Test::Exception;
23
use Test::Exception;
24
use MARC::Field;
24
use MARC::Field;
25
25
Lines 81-102 subtest 'holds + current_holds' => sub { Link Here
81
81
82
};
82
};
83
83
84
subtest 'subscriptions' => sub {
85
    plan tests => 2;
86
    $builder->build(
87
        { source => 'Subscription', value => { biblionumber => $biblio->id } }
88
    );
89
    $builder->build(
90
        { source => 'Subscription', value => { biblionumber => $biblio->id } }
91
    );
92
    my $biblio        = Koha::Biblios->find( $biblio->id );
93
    my $subscriptions = $biblio->subscriptions;
94
    is( ref($subscriptions), 'Koha::Subscriptions',
95
        'Koha::Biblio->subscriptions should return a Koha::Subscriptions object'
96
    );
97
    is( $subscriptions->count, 2, 'Koha::Biblio->subscriptions should return the correct number of subscriptions');
98
};
99
100
subtest 'waiting_or_in_transit' => sub {
84
subtest 'waiting_or_in_transit' => sub {
101
    plan tests => 4;
85
    plan tests => 4;
102
    my $biblio = $builder->build( { source => 'Biblio' } );
86
    my $biblio = $builder->build( { source => 'Biblio' } );
103
- 

Return to bug 24448