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

(-)a/t/db_dependent/Koha/Item/Transfers.t (-2 / +23 lines)
Lines 19-25 Link Here
19
19
20
use Modern::Perl;
20
use Modern::Perl;
21
21
22
use Test::More tests => 3;
22
use Test::More tests => 4;
23
23
24
use Koha::Item::Transfer;
24
use Koha::Item::Transfer;
25
use Koha::Item::Transfers;
25
use Koha::Item::Transfers;
Lines 109-111 subtest 'daterequested tests' => sub { Link Here
109
109
110
    $schema->storage->txn_rollback;
110
    $schema->storage->txn_rollback;
111
};
111
};
112
- 
112
113
subtest 'filter_by_current() tests' => sub {
114
115
    plan tests => 3;
116
117
    $schema->storage->txn_begin;
118
119
    my $transfer_1 = $builder->build_object({ class => 'Koha::Item::Transfers', value => { datearrived => \'NOW()', datecancelled => undef } });
120
    my $transfer_2 = $builder->build_object({ class => 'Koha::Item::Transfers', value => { datearrived => undef, datecancelled => \'NOW()' } });
121
    my $transfer_3 = $builder->build_object({ class => 'Koha::Item::Transfers', value => { datearrived => undef, datecancelled => undef } });
122
123
    my $rs = Koha::Item::Transfers->search({ branchtransfer_id => [ $transfer_1->id, $transfer_2->id, $transfer_3->id ] });
124
125
    is( $rs->count, 3, 'Resultset has 3 transfers' );
126
127
    $rs = $rs->filter_by_current;
128
129
    is( $rs->count, 1, 'Filtered resultset has 1 transfer' );
130
    is( $rs->next->id, $transfer_3->id, 'Only current transfer left on the resultset' );
131
132
    $schema->storage->txn_rollback;
133
};

Return to bug 31183