|
Lines 659-665
subtest 'creator ()' => sub {
Link Here
|
| 659 |
|
659 |
|
| 660 |
subtest 'cancel() tests' => sub { |
660 |
subtest 'cancel() tests' => sub { |
| 661 |
|
661 |
|
| 662 |
plan tests => 56; |
662 |
plan tests => 58; |
| 663 |
|
663 |
|
| 664 |
$schema->storage->txn_begin; |
664 |
$schema->storage->txn_begin; |
| 665 |
|
665 |
|
|
Lines 1017-1021
subtest 'cancel() tests' => sub {
Link Here
|
| 1017 |
lives_ok { $order->set($columns)->store; } 'No croak on missing biblionumber when cancelling an order'; |
1017 |
lives_ok { $order->set($columns)->store; } 'No croak on missing biblionumber when cancelling an order'; |
| 1018 |
throws_ok { $order->orderstatus('new')->store; } qr/Cannot insert order: Mandatory parameter biblionumber is missing/, 'Expected croak'; |
1018 |
throws_ok { $order->orderstatus('new')->store; } qr/Cannot insert order: Mandatory parameter biblionumber is missing/, 'Expected croak'; |
| 1019 |
|
1019 |
|
|
|
1020 |
# Try to cancel again, not overwriting cancellation date |
| 1021 |
my $dt = dt_from_string->subtract( days => 1 ); |
| 1022 |
$order->biblionumber($biblio_id)->datecancellationprinted($dt)->orderstatus('new')->store; |
| 1023 |
$order->cancel; |
| 1024 |
$order->discard_changes; |
| 1025 |
is( $order->orderstatus, 'cancelled', 'Check status after second cancel' ); |
| 1026 |
is( $order->datecancellationprinted, $dt->ymd, 'Check date after second cancel' ); |
| 1027 |
|
| 1020 |
$schema->storage->txn_rollback; |
1028 |
$schema->storage->txn_rollback; |
| 1021 |
}; |
1029 |
}; |
| 1022 |
- |
|
|