Lines 624-630
subtest 'filter_by_current & filter_by_cancelled' => sub {
Link Here
|
624 |
|
624 |
|
625 |
subtest 'cancel() tests' => sub { |
625 |
subtest 'cancel() tests' => sub { |
626 |
|
626 |
|
627 |
plan tests => 52; |
627 |
plan tests => 54; |
628 |
|
628 |
|
629 |
$schema->storage->txn_begin; |
629 |
$schema->storage->txn_begin; |
630 |
|
630 |
|
Lines 915-919
subtest 'cancel() tests' => sub {
Link Here
|
915 |
is( $messages[2]->message, 'error_delbiblio_items', 'Cannot delete on loan item' ); |
915 |
is( $messages[2]->message, 'error_delbiblio_items', 'Cannot delete on loan item' ); |
916 |
is( $messages[2]->payload->{biblio}->id, $biblio_id, 'The right biblio is attached' ); |
916 |
is( $messages[2]->payload->{biblio}->id, $biblio_id, 'The right biblio is attached' ); |
917 |
|
917 |
|
|
|
918 |
# Call ->store with biblionumber NULL (as ->cancel does) |
919 |
$item_1 = $builder->build_sample_item; |
920 |
$biblio_id = $item_1->biblionumber; |
921 |
$order= $builder->build_object({ |
922 |
class => 'Koha::Acquisition::Orders', |
923 |
value => { |
924 |
orderstatus => 'new', |
925 |
biblionumber => $biblio_id, |
926 |
datecancellationprinted => undef, |
927 |
cancellationreason => undef, |
928 |
} |
929 |
}); |
930 |
my $columns = { |
931 |
biblionumber => undef, |
932 |
cancellationreason => $reason, |
933 |
datecancellationprinted => \'NOW()', |
934 |
orderstatus => 'cancelled', |
935 |
}; |
936 |
lives_ok { $order->set($columns)->store; } 'No croak on missing biblionumber when cancelling an order'; |
937 |
throws_ok { $order->orderstatus('new')->store; } qr/Cannot insert order: Mandatory parameter biblionumber is missing/, 'Expected croak'; |
938 |
|
918 |
$schema->storage->txn_rollback; |
939 |
$schema->storage->txn_rollback; |
919 |
}; |
940 |
}; |
920 |
- |
|
|