|
Lines 638-644
subtest 'cancel() tests' => sub {
Link Here
|
| 638 |
is( $order->cancellationreason, $reason, 'cancellationreason is set' ); |
638 |
is( $order->cancellationreason, $reason, 'cancellationreason is set' ); |
| 639 |
is( ref(Koha::Items->find($item->id)), 'Koha::Item', 'The item is present' ); |
639 |
is( ref(Koha::Items->find($item->id)), 'Koha::Item', 'The item is present' ); |
| 640 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is present' ); |
640 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is present' ); |
| 641 |
my @messages = @{ $order->messages }; |
641 |
my @messages = @{ $order->object_messages }; |
| 642 |
is( $messages[0]->message, 'error_delitem', 'An error message is attached to the order' ); |
642 |
is( $messages[0]->message, 'error_delitem', 'An error message is attached to the order' ); |
| 643 |
|
643 |
|
| 644 |
# Scenario: |
644 |
# Scenario: |
|
Lines 660-666
subtest 'cancel() tests' => sub {
Link Here
|
| 660 |
is( $order->cancellationreason, $reason, 'cancellationreason is undef' ); |
660 |
is( $order->cancellationreason, $reason, 'cancellationreason is undef' ); |
| 661 |
is( Koha::Items->find($item->id), undef, 'The item is no longer present' ); |
661 |
is( Koha::Items->find($item->id), undef, 'The item is no longer present' ); |
| 662 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is present' ); |
662 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is present' ); |
| 663 |
@messages = @{ $order->messages }; |
663 |
@messages = @{ $order->object_messages }; |
| 664 |
is( scalar @messages, 0, 'No messages' ); |
664 |
is( scalar @messages, 0, 'No messages' ); |
| 665 |
|
665 |
|
| 666 |
# Scenario: |
666 |
# Scenario: |
|
Lines 696-702
subtest 'cancel() tests' => sub {
Link Here
|
| 696 |
is( Koha::Items->find($item_1->id), undef, 'The item is no longer present' ); |
696 |
is( Koha::Items->find($item_1->id), undef, 'The item is no longer present' ); |
| 697 |
is( ref(Koha::Items->find($item_2->id)), 'Koha::Item', 'The item is still present' ); |
697 |
is( ref(Koha::Items->find($item_2->id)), 'Koha::Item', 'The item is still present' ); |
| 698 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
698 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
| 699 |
@messages = @{ $order->messages }; |
699 |
@messages = @{ $order->object_messages }; |
| 700 |
is( $messages[0]->message, 'error_delbiblio_items', 'Cannot delete biblio and it gets notified' ); |
700 |
is( $messages[0]->message, 'error_delbiblio_items', 'Cannot delete biblio and it gets notified' ); |
| 701 |
|
701 |
|
| 702 |
# Scenario: |
702 |
# Scenario: |
|
Lines 743-749
subtest 'cancel() tests' => sub {
Link Here
|
| 743 |
is( $order->cancellationreason, $reason, 'cancellationreason is undef' ); |
743 |
is( $order->cancellationreason, $reason, 'cancellationreason is undef' ); |
| 744 |
is( Koha::Items->find($item->id), undef, 'The item is no longer present' ); |
744 |
is( Koha::Items->find($item->id), undef, 'The item is no longer present' ); |
| 745 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
745 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
| 746 |
@messages = @{ $order->messages }; |
746 |
@messages = @{ $order->object_messages }; |
| 747 |
is( $messages[0]->message, 'error_delbiblio_active_orders', 'Cannot delete biblio and it gets notified' ); |
747 |
is( $messages[0]->message, 'error_delbiblio_active_orders', 'Cannot delete biblio and it gets notified' ); |
| 748 |
|
748 |
|
| 749 |
# Scenario: |
749 |
# Scenario: |
|
Lines 787-793
subtest 'cancel() tests' => sub {
Link Here
|
| 787 |
is( $order->cancellationreason, $reason, 'cancellationreason is undef' ); |
787 |
is( $order->cancellationreason, $reason, 'cancellationreason is undef' ); |
| 788 |
is( Koha::Items->find($item->id), undef, 'The item is no longer present' ); |
788 |
is( Koha::Items->find($item->id), undef, 'The item is no longer present' ); |
| 789 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
789 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
| 790 |
@messages = @{ $order->messages }; |
790 |
@messages = @{ $order->object_messages }; |
| 791 |
is( $messages[0]->message, 'error_delbiblio_subscriptions', 'Cannot delete biblio and it gets notified' ); |
791 |
is( $messages[0]->message, 'error_delbiblio_subscriptions', 'Cannot delete biblio and it gets notified' ); |
| 792 |
|
792 |
|
| 793 |
# Scenario: |
793 |
# Scenario: |
|
Lines 820-826
subtest 'cancel() tests' => sub {
Link Here
|
| 820 |
is( $order->cancellationreason, $reason, 'cancellationreason is set' ); |
820 |
is( $order->cancellationreason, $reason, 'cancellationreason is set' ); |
| 821 |
is( Koha::Items->find($item->id), undef, 'The item is not present' ); |
821 |
is( Koha::Items->find($item->id), undef, 'The item is not present' ); |
| 822 |
is( Koha::Biblios->find($biblio_id), undef, 'The biblio is not present' ); |
822 |
is( Koha::Biblios->find($biblio_id), undef, 'The biblio is not present' ); |
| 823 |
@messages = @{ $order->messages }; |
823 |
@messages = @{ $order->object_messages }; |
| 824 |
is( scalar @messages, 0, 'No errors' ); |
824 |
is( scalar @messages, 0, 'No errors' ); |
| 825 |
|
825 |
|
| 826 |
# Scenario: |
826 |
# Scenario: |
|
Lines 873-879
subtest 'cancel() tests' => sub {
Link Here
|
| 873 |
is( Koha::Items->find($item_1->id), undef, 'The item is no longer present' ); |
873 |
is( Koha::Items->find($item_1->id), undef, 'The item is no longer present' ); |
| 874 |
is( ref(Koha::Items->find($item_2->id)), 'Koha::Item', 'The on loan item is still present' ); |
874 |
is( ref(Koha::Items->find($item_2->id)), 'Koha::Item', 'The on loan item is still present' ); |
| 875 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
875 |
is( ref(Koha::Biblios->find($biblio_id)), 'Koha::Biblio', 'The biblio is still present' ); |
| 876 |
@messages = @{ $order->messages }; |
876 |
@messages = @{ $order->object_messages }; |
| 877 |
is( $messages[0]->message, 'error_delitem', 'Cannot delete on loan item' ); |
877 |
is( $messages[0]->message, 'error_delitem', 'Cannot delete on loan item' ); |
| 878 |
is( $messages[0]->payload->{item}->id, $item_2->id, 'Cannot delete on loan item' ); |
878 |
is( $messages[0]->payload->{item}->id, $item_2->id, 'Cannot delete on loan item' ); |
| 879 |
is( $messages[0]->payload->{reason}, 'book_on_loan', 'Item on loan notified' ); |
879 |
is( $messages[0]->payload->{reason}, 'book_on_loan', 'Item on loan notified' ); |