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

(-)a/t/db_dependent/Holds.t (-2 / +56 lines)
Lines 7-13 use t::lib::TestBuilder; Link Here
7
7
8
use C4::Context;
8
use C4::Context;
9
9
10
use Test::More tests => 71;
10
use Test::More tests => 72;
11
use MARC::Record;
11
use MARC::Record;
12
12
13
use C4::Biblio;
13
use C4::Biblio;
Lines 1610-1612 subtest 'CanItemBeReserved rule precedence tests' => sub { Link Here
1610
    $schema->storage->txn_rollback;
1610
    $schema->storage->txn_rollback;
1611
1611
1612
};
1612
};
1613
- 
1613
1614
subtest 'CanItemBeReserved rule precedence tests' => sub {
1615
    plan tests => 2;
1616
1617
    $schema->storage->txn_begin;
1618
1619
    my $category = $builder->build({ source => 'Category' });
1620
    my $branch = $builder->build({ source => 'Branch' })->{ branchcode };
1621
    my $biblio = $builder->build_sample_biblio( { itemtype => 'DUMMY' } );
1622
    my $itemnumber = $builder->build_sample_item(
1623
        { library => $branch, biblionumber => $biblio->biblionumber } )
1624
      ->itemnumber;
1625
1626
    my $borrowernumber = Koha::Patron->new(
1627
        {
1628
            firstname    => 'my firstname',
1629
            surname      => 'my surname ' . $_,
1630
            categorycode => $category->{categorycode},
1631
            branchcode   => $branch,
1632
        }
1633
    )->store->borrowernumber;
1634
1635
    my $reserve_id = AddReserve(
1636
        {
1637
            branchcode     => $branch,
1638
            borrowernumber => $borrowernumber,
1639
            biblionumber   => $biblio->biblionumber,
1640
            priority       =>
1641
              C4::Reserves::CalculatePriority( $biblio->biblionumber ),
1642
            itemnumber => $itemnumber,
1643
        }
1644
    );
1645
1646
    my $hold = Koha::Holds->find($reserve_id);
1647
1648
    $hold->set( { priority => 0, found => 'W' } )->store();
1649
1650
    ModReserve(
1651
        {
1652
            reserve_id     => $hold->id,
1653
            expirationdate => '1981-06-10',
1654
            priority       => 99,
1655
            rank           => 0,
1656
        }
1657
    );
1658
1659
    $hold = Koha::Holds->find($reserve_id);
1660
1661
    is( $hold->expirationdate, '1981-06-10',
1662
        'Found hold expiration date updated correctly' );
1663
    is( $hold->priority, '0', 'Found hold priority was not updated' );
1664
1665
    $schema->storage->txn_rollback;
1666
1667
};

Return to bug 25619