Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 1; |
20 |
use Test::More tests => 2; |
21 |
use Test::Exception; |
21 |
use Test::Exception; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 56-58
subtest 'attributes' => sub {
Link Here
|
56 |
|
56 |
|
57 |
$schema->storage->txn_rollback; |
57 |
$schema->storage->txn_rollback; |
58 |
}; |
58 |
}; |
59 |
- |
59 |
|
|
|
60 |
subtest 'can_be_deleted' => sub { |
61 |
|
62 |
plan tests => 5; |
63 |
|
64 |
$schema->storage->txn_begin; |
65 |
|
66 |
my $processing = $builder->build_object( { class => 'Koha::Preservation::Processings' } ); |
67 |
my $another_processing = $builder->build_object( { class => 'Koha::Preservation::Processings' } ); |
68 |
|
69 |
is( $processing->can_be_deleted, 1, 'processing is not used, it can be deleted' ); |
70 |
|
71 |
my $train = $builder->build_object( |
72 |
{ |
73 |
class => 'Koha::Preservation::Trains', |
74 |
value => { |
75 |
not_for_loan => 42, |
76 |
default_processing_id => $processing->processing_id, |
77 |
closed_on => undef, |
78 |
sent_on => undef, |
79 |
received_on => undef |
80 |
} |
81 |
} |
82 |
); |
83 |
|
84 |
is( $processing->can_be_deleted, 0, 'processing is used, it cannot be deleted' ); |
85 |
is( $another_processing->can_be_deleted, 1, 'processing is not used, it can be deleted' ); |
86 |
|
87 |
my $item = $builder->build_sample_item; |
88 |
$train->add_item( { item_id => $item->itemnumber, processing_id => $another_processing->processing_id }, { skip_waiting_list_check => 1 } ); |
89 |
is( $processing->can_be_deleted, 0, 'processing is used, it cannot be deleted' ); |
90 |
is( $another_processing->can_be_deleted, 0, 'processing is used, it cannot be deleted' ); |
91 |
|
92 |
$schema->storage->txn_rollback; |
93 |
}; |