Lines 36-42
t::lib::Mocks::mock_preference('EnableItemGroups', 1);
Link Here
|
36 |
|
36 |
|
37 |
subtest 'add_item() and items() tests' => sub { |
37 |
subtest 'add_item() and items() tests' => sub { |
38 |
|
38 |
|
39 |
plan tests => 8; |
39 |
plan tests => 10; |
40 |
|
40 |
|
41 |
$schema->storage->txn_begin; |
41 |
$schema->storage->txn_begin; |
42 |
|
42 |
|
Lines 66-70
subtest 'add_item() and items() tests' => sub {
Link Here
|
66 |
is( scalar(@items), 1, 'Item group now has only one item'); |
66 |
is( scalar(@items), 1, 'Item group now has only one item'); |
67 |
is( $items[0]->id, $item_2->id, 'Item 2 is correct' ); |
67 |
is( $items[0]->id, $item_2->id, 'Item 2 is correct' ); |
68 |
|
68 |
|
|
|
69 |
# Remove last item |
70 |
$item_2->delete; |
71 |
@items = $item_group->items->as_list(); |
72 |
is( scalar(@items), 0, "Item group now has no items"); |
73 |
$item_group = Koha::Biblio::ItemGroups->find( $item_group->id ); |
74 |
is( $item_group, undef, 'ItemGroup is deleted when last item is deleted' ); |
75 |
|
69 |
$schema->storage->txn_rollback; |
76 |
$schema->storage->txn_rollback; |
70 |
}; |
77 |
}; |
71 |
- |
|
|