|
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 533-537
subtest 'filter_by_late' => sub {
Link Here
|
| 533 |
); |
533 |
); |
| 534 |
is( $late_orders->count, 1 ); |
534 |
is( $late_orders->count, 1 ); |
| 535 |
|
535 |
|
|
|
536 |
$schema->storage->txn_rollback; |
| 537 |
}; |
| 538 |
|
| 539 |
subtest 'filter_by_current & filter_by_cancelled' => sub { |
| 540 |
plan tests => 2; |
| 541 |
|
| 542 |
$schema->storage->txn_begin; |
| 543 |
my $now = dt_from_string; |
| 544 |
my $order_1 = $builder->build_object( |
| 545 |
{ |
| 546 |
class => 'Koha::Acquisition::Orders', |
| 547 |
value => { |
| 548 |
datecancellationprinted => undef, |
| 549 |
} |
| 550 |
} |
| 551 |
); |
| 552 |
my $order_2 = $builder->build_object( |
| 553 |
{ |
| 554 |
class => 'Koha::Acquisition::Orders', |
| 555 |
value => { |
| 556 |
datecancellationprinted => undef, |
| 557 |
} |
| 558 |
} |
| 559 |
); |
| 560 |
my $order_3 = $builder->build_object( |
| 561 |
{ |
| 562 |
class => 'Koha::Acquisition::Orders', |
| 563 |
value => { |
| 564 |
datecancellationprinted => dt_from_string, |
| 565 |
} |
| 566 |
} |
| 567 |
); |
| 568 |
|
| 569 |
my $orders = Koha::Acquisition::Orders->search( |
| 570 |
{ |
| 571 |
ordernumber => { |
| 572 |
-in => [ |
| 573 |
$order_1->ordernumber, $order_2->ordernumber, |
| 574 |
$order_3->ordernumber, |
| 575 |
] |
| 576 |
} |
| 577 |
} |
| 578 |
); |
| 579 |
|
| 580 |
is( $orders->filter_by_current->count, 2); |
| 581 |
is( $orders->filter_by_cancelled->count, 1); |
| 582 |
|
| 583 |
|
| 536 |
$schema->storage->txn_rollback; |
584 |
$schema->storage->txn_rollback; |
| 537 |
}; |
585 |
}; |
| 538 |
- |
|
|