Bug 22059: regression tests
[koha.git] / t / db_dependent / Hold.t
index 7eb04ab..4258ba3 100755 (executable)
@@ -29,7 +29,7 @@ use Koha::Item;
 use Koha::DateUtils;
 use t::lib::TestBuilder;
 
-use Test::More tests => 31;
+use Test::More tests => 33;
 use Test::Warn;
 
 use_ok('Koha::Hold');
@@ -92,6 +92,9 @@ $hold->suspend_hold( $dt );
 $dt->truncate( to => 'day' );
 is( $hold->suspend, 1, "Hold is suspended" );
 is( $hold->suspend_until, "$dt", "Hold is suspended with a date, truncation takes place automatically" );
+$hold->suspend_hold;
+is( $hold->suspend, 1, "Hold is suspended" );
+is( $hold->suspend_until, undef, "Hold is suspended without a date" );
 $hold->resume();
 is( $hold->suspend, 0, "Hold is not suspended" );
 is( $hold->suspend_until, undef, "Hold no longer has suspend_until date" );
@@ -121,13 +124,13 @@ isnt( $hold->is_waiting, 1, 'The hold is not waiting (W)' );
 is( $hold->is_found, 0, 'The hold is not found' );
 ok( !$hold->is_in_transit, 'The hold is not in transit' );
 
-# Test method is_cancelable
+# Test method is_cancelable_from_opac
 $hold->found(undef);
-ok( $hold->is_cancelable(), "Unfound hold is cancelable" );
+is( $hold->is_cancelable_from_opac, 1, "Unfound hold is cancelable" );
 $hold->found('W');
-ok( $hold->is_cancelable, "Waiting hold is cancelable" );
+is( $hold->is_cancelable_from_opac, 0, "Waiting hold is not cancelable" );
 $hold->found('T');
-ok( !$hold->is_cancelable, "In transit hold is not cancelable" );
+is( $hold->is_cancelable_from_opac, 0, "In transit hold is not cancelable" );
 
 # Test method is_at_destination
 $hold->found(undef);