Lines 124-136
my $item_type = $builder->build_object({ class => 'Koha::ItemTypes' });
Link Here
|
124 |
|
124 |
|
125 |
is( $item_type->can_be_deleted, 1, 'An item type that is not used can be deleted'); |
125 |
is( $item_type->can_be_deleted, 1, 'An item type that is not used can be deleted'); |
126 |
|
126 |
|
127 |
my $item = $builder->build_object({ class => 'Koha::Items', value => { itype => $item_type->itemtype }}); |
127 |
my $item = $builder->build_sample_item({ itype => $item_type->itemtype }); |
128 |
is( $item_type->can_be_deleted, 0, 'An item type that is used by an item cannot be deleted' ); |
128 |
is( $item_type->can_be_deleted, 0, 'An item type that is used by an item cannot be deleted' ); |
129 |
$item->delete; |
129 |
$item->delete; |
130 |
|
130 |
|
131 |
my $biblioitem = $builder->build_object({ class => 'Koha::Biblioitems', value => { itemtype => $item_type->itemtype }}); |
131 |
my $biblio = $builder->build_sample_biblio({ itemtype => $item_type->itemtype }); |
132 |
is ( $item_type->can_be_deleted, 0, 'An item type that is used by an item and a biblioitem cannot be deleted' ); |
132 |
is ( $item_type->can_be_deleted, 0, 'An item type that is used by an item and a biblioitem cannot be deleted' ); |
133 |
$biblioitem->delete; |
133 |
$biblio->delete; |
134 |
|
134 |
|
135 |
is ( $item_type->can_be_deleted, 1, 'The item type that was being used by the removed item and biblioitem can now be deleted' ); |
135 |
is ( $item_type->can_be_deleted, 1, 'The item type that was being used by the removed item and biblioitem can now be deleted' ); |
136 |
|
136 |
|
137 |
- |
|
|