|
Lines 19-25
Link Here
|
| 19 |
|
19 |
|
| 20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
| 21 |
|
21 |
|
| 22 |
use Test::More tests => 10; |
22 |
use Test::More tests => 11; |
| 23 |
|
23 |
|
| 24 |
use t::lib::TestBuilder; |
24 |
use t::lib::TestBuilder; |
| 25 |
use t::lib::Mocks; |
25 |
use t::lib::Mocks; |
|
Lines 536-538
subtest 'filter_by_late' => sub {
Link Here
|
| 536 |
|
536 |
|
| 537 |
$schema->storage->txn_rollback; |
537 |
$schema->storage->txn_rollback; |
| 538 |
}; |
538 |
}; |
| 539 |
- |
539 |
|
|
|
540 |
subtest 'filter_by_current & filter_by_cancelled' => sub { |
| 541 |
plan tests => 2; |
| 542 |
|
| 543 |
$schema->storage->txn_begin; |
| 544 |
my $now = dt_from_string; |
| 545 |
my $order_1 = $builder->build_object( |
| 546 |
{ |
| 547 |
class => 'Koha::Acquisition::Orders', |
| 548 |
value => { |
| 549 |
datecancellationprinted => undef, |
| 550 |
} |
| 551 |
} |
| 552 |
); |
| 553 |
my $order_2 = $builder->build_object( |
| 554 |
{ |
| 555 |
class => 'Koha::Acquisition::Orders', |
| 556 |
value => { |
| 557 |
datecancellationprinted => undef, |
| 558 |
} |
| 559 |
} |
| 560 |
); |
| 561 |
my $order_3 = $builder->build_object( |
| 562 |
{ |
| 563 |
class => 'Koha::Acquisition::Orders', |
| 564 |
value => { |
| 565 |
datecancellationprinted => dt_from_string, |
| 566 |
} |
| 567 |
} |
| 568 |
); |
| 569 |
|
| 570 |
my $orders = Koha::Acquisition::Orders->search( |
| 571 |
{ |
| 572 |
ordernumber => { |
| 573 |
-in => [ |
| 574 |
$order_1->ordernumber, $order_2->ordernumber, |
| 575 |
$order_3->ordernumber, |
| 576 |
] |
| 577 |
} |
| 578 |
} |
| 579 |
); |
| 580 |
|
| 581 |
is( $orders->filter_by_current->count, 2); |
| 582 |
is( $orders->filter_by_cancelled->count, 1); |
| 583 |
|
| 584 |
|
| 585 |
$schema->storage->txn_rollback; |
| 586 |
}; |