|
Lines 35-41
my $builder = t::lib::TestBuilder->new;
Link Here
|
| 35 |
|
35 |
|
| 36 |
subtest 'Koha::RefundLostItemFeeRule::delete() tests' => sub { |
36 |
subtest 'Koha::RefundLostItemFeeRule::delete() tests' => sub { |
| 37 |
|
37 |
|
| 38 |
plan tests => 7; |
38 |
plan tests => 5; |
| 39 |
|
39 |
|
| 40 |
# Start transaction |
40 |
# Start transaction |
| 41 |
$schema->storage->txn_begin; |
41 |
$schema->storage->txn_begin; |
|
Lines 68-88
subtest 'Koha::RefundLostItemFeeRule::delete() tests' => sub {
Link Here
|
| 68 |
$other_rule->delete; |
68 |
$other_rule->delete; |
| 69 |
ok( !$other_rule->in_storage, 'Other rule deleted from storage' ); |
69 |
ok( !$other_rule->in_storage, 'Other rule deleted from storage' ); |
| 70 |
|
70 |
|
| 71 |
# deleting the default rule |
|
|
| 72 |
eval { |
| 73 |
$default_rule->delete; |
| 74 |
}; |
| 75 |
is( ref($@), 'Koha::Exceptions::CannotDeleteDefault', |
| 76 |
'Exception on deleting default' ); |
| 77 |
ok( $default_rule->in_storage, 'Default rule still in storage' ); |
| 78 |
|
| 79 |
# Rollback transaction |
71 |
# Rollback transaction |
| 80 |
$schema->storage->txn_rollback; |
72 |
$schema->storage->txn_rollback; |
| 81 |
}; |
73 |
}; |
| 82 |
|
74 |
|
| 83 |
subtest 'Koha::RefundLostItemFeeRules::_default_rule() tests' => sub { |
75 |
subtest 'Koha::RefundLostItemFeeRules::_default_rule() tests' => sub { |
| 84 |
|
76 |
|
| 85 |
plan tests => 4; |
77 |
plan tests => 6; |
| 86 |
|
78 |
|
| 87 |
# Start transaction |
79 |
# Start transaction |
| 88 |
$schema->storage->txn_begin; |
80 |
$schema->storage->txn_begin; |
|
Lines 115-120
subtest 'Koha::RefundLostItemFeeRules::_default_rule() tests' => sub {
Link Here
|
| 115 |
branchcode => '*' }); |
107 |
branchcode => '*' }); |
| 116 |
ok( !Koha::RefundLostItemFeeRules->_default_rule, 'Default rule is set to not refund' ); |
108 |
ok( !Koha::RefundLostItemFeeRules->_default_rule, 'Default rule is set to not refund' ); |
| 117 |
|
109 |
|
|
|
110 |
$default_rule->delete; |
| 111 |
ok( !$default_rule->in_storage, 'Default rule effectively deleted from storage' ); |
| 112 |
|
| 113 |
ok( Koha::RefundLostItemFeeRules->_default_rule, 'Default rule is set to refund if no default rule is present' ); |
| 114 |
|
| 118 |
# Rollback transaction |
115 |
# Rollback transaction |
| 119 |
$schema->storage->txn_rollback; |
116 |
$schema->storage->txn_rollback; |
| 120 |
}; |
117 |
}; |
| 121 |
- |
|
|