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

(-)a/t/db_dependent/Koha/Biblio.t (-2 / +35 lines)
Lines 17-26 Link Here
17
17
18
use Modern::Perl;
18
use Modern::Perl;
19
19
20
use Test::More tests => 10;
20
use Test::More tests => 11;
21
21
22
use C4::Biblio;
22
use C4::Biblio;
23
use Koha::Database;
23
use Koha::Database;
24
use Koha::Acquisition::Orders;
24
25
25
use t::lib::TestBuilder;
26
use t::lib::TestBuilder;
26
use t::lib::Mocks;
27
use t::lib::Mocks;
Lines 490-492 subtest 'suggestions() tests' => sub { Link Here
490
491
491
    $schema->storage->txn_rollback;
492
    $schema->storage->txn_rollback;
492
};
493
};
493
- 
494
495
subtest 'orders() and orders_count() tests' => sub {
496
497
    plan tests => 4;
498
499
    $schema->storage->txn_begin;
500
501
    my $biblio = $builder->build_sample_biblio();
502
503
    my $orders = $biblio->orders;
504
    my $orders_count = $biblio->orders_count;
505
506
    is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' );
507
    is( $orders->count, $orders_count, '->orders_count returns the count for the resultset' );
508
509
    # Add a couple orders
510
    foreach (1..2) {
511
        $builder->build_object(
512
            {
513
                class => 'Koha::Acquisition::Orders',
514
                value => { biblionumber => $biblio->biblionumber }
515
            }
516
        );
517
    }
518
519
    $orders = $biblio->orders;
520
    $orders_count = $biblio->orders_count;
521
522
    is( ref($orders), 'Koha::Acquisition::Orders', 'Result type is correct' );
523
    is( $orders->count, $orders_count, '->orders_count returns the count for the resultset' );
524
525
    $schema->storage->txn_rollback;
526
};

Return to bug 24430