|
Lines 17-24
my $schema = Koha::Database->new->schema;
Link Here
|
| 17 |
$schema->storage->txn_begin; |
17 |
$schema->storage->txn_begin; |
| 18 |
my $builder = t::lib::TestBuilder->new; |
18 |
my $builder = t::lib::TestBuilder->new; |
| 19 |
|
19 |
|
| 20 |
Koha::AuthorisedValues->delete; |
20 |
my @existing_categories = Koha::AuthorisedValues->new->categories; |
| 21 |
Koha::AuthorisedValueCategories->delete; |
|
|
| 22 |
|
21 |
|
| 23 |
# insert |
22 |
# insert |
| 24 |
Koha::AuthorisedValueCategory->new({ category_name => 'av_for_testing', is_system => 1 })->store; |
23 |
Koha::AuthorisedValueCategory->new({ category_name => 'av_for_testing', is_system => 1 })->store; |
|
Lines 137-150
my $limits = $av1->library_limits->as_list;
Link Here
|
| 137 |
is( @$limits, 2, 'library_limits functions correctly both as setter and getter' ); |
136 |
is( @$limits, 2, 'library_limits functions correctly both as setter and getter' ); |
| 138 |
|
137 |
|
| 139 |
my @categories = Koha::AuthorisedValues->new->categories; |
138 |
my @categories = Koha::AuthorisedValues->new->categories; |
| 140 |
is( @categories, 3, 'There should have 2 categories inserted' ); |
139 |
is( @categories, @existing_categories+3, 'There should have 3 categories inserted' ); |
| 141 |
is( $categories[0], $av4->category, 'The first category should be correct (ordered by category name)' ); |
140 |
is( $categories[0], $av4->category, 'The first category should be correct (ordered by category name)' ); |
| 142 |
is( $categories[1], $av1->category, 'The second category should be correct (ordered by category name)' ); |
141 |
is( $categories[1], $av1->category, 'The second category should be correct (ordered by category name)' ); |
| 143 |
|
142 |
|
| 144 |
subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { |
143 |
subtest 'search_by_*_field + find_by_koha_field + get_description' => sub { |
| 145 |
plan tests => 5; |
144 |
plan tests => 5; |
| 146 |
my $loc_cat = Koha::AuthorisedValueCategories->find('LOC'); |
145 |
|
| 147 |
$loc_cat->delete if $loc_cat; |
146 |
my $test_cat = Koha::AuthorisedValueCategories->find('TEST'); |
|
|
147 |
$test_cat->delete if $test_cat; |
| 148 |
my $mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => 'c', frameworkcode => '' } ); |
148 |
my $mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => 'c', frameworkcode => '' } ); |
| 149 |
$mss->delete if $mss; |
149 |
$mss->delete if $mss; |
| 150 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ' } ); |
150 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ' } ); |
|
Lines 153-167
subtest 'search_by_*_field + find_by_koha_field + get_description' => sub {
Link Here
|
| 153 |
$mss->delete if $mss; |
153 |
$mss->delete if $mss; |
| 154 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => '5', frameworkcode => '' } ); |
154 |
$mss = Koha::MarcSubfieldStructures->search( { tagfield => 952, tagsubfield => '5', frameworkcode => '' } ); |
| 155 |
$mss->delete if $mss; |
155 |
$mss->delete if $mss; |
| 156 |
Koha::AuthorisedValueCategory->new( { category_name => 'LOC' } )->store; |
156 |
Koha::AuthorisedValueCategory->new( { category_name => 'TEST' } )->store; |
| 157 |
Koha::AuthorisedValueCategory->new( { category_name => 'ANOTHER_4_TESTS' } )->store; |
157 |
Koha::AuthorisedValueCategory->new( { category_name => 'ANOTHER_4_TESTS' } )->store; |
| 158 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => '', authorised_value => 'LOC', kohafield => 'items.location' } )->store; |
158 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => '', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
| 159 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ', authorised_value => 'LOC', kohafield => 'items.location' } )->store; |
159 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'c', frameworkcode => 'ACQ', authorised_value => 'TEST', kohafield => 'items.location' } )->store; |
| 160 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'd', frameworkcode => '', authorised_value => 'ANOTHER_4_TESTS', kohafield => 'items.another_field' } )->store; |
160 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => 'd', frameworkcode => '', authorised_value => 'ANOTHER_4_TESTS', kohafield => 'items.another_field' } )->store; |
| 161 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => '5', frameworkcode => '', authorised_value => 'restricted_for_testing', kohafield => 'items.restricted' } )->store; |
161 |
Koha::MarcSubfieldStructure->new( { tagfield => 952, tagsubfield => '5', frameworkcode => '', authorised_value => 'restricted_for_testing', kohafield => 'items.restricted' } )->store; |
| 162 |
Koha::AuthorisedValue->new( { category => 'LOC', authorised_value => 'location_1' } )->store; |
162 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_1' } )->store; |
| 163 |
Koha::AuthorisedValue->new( { category => 'LOC', authorised_value => 'location_2' } )->store; |
163 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_2' } )->store; |
| 164 |
Koha::AuthorisedValue->new( { category => 'LOC', authorised_value => 'location_3' } )->store; |
164 |
Koha::AuthorisedValue->new( { category => 'TEST', authorised_value => 'location_3' } )->store; |
| 165 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store; |
165 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'an_av' } )->store; |
| 166 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store; |
166 |
Koha::AuthorisedValue->new( { category => 'ANOTHER_4_TESTS', authorised_value => 'another_av' } )->store; |
| 167 |
subtest 'search_by_marc_field' => sub { |
167 |
subtest 'search_by_marc_field' => sub { |
| 168 |
- |
|
|