Lines 1-7
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
3 |
use Modern::Perl; |
3 |
use Modern::Perl; |
4 |
use Test::More tests => 15; |
4 |
use Test::More tests => 17; |
|
|
5 |
use Try::Tiny; |
5 |
|
6 |
|
6 |
use t::lib::TestBuilder; |
7 |
use t::lib::TestBuilder; |
7 |
|
8 |
|
Lines 20-26
Koha::AuthorisedValues->delete;
Link Here
|
20 |
Koha::AuthorisedValueCategories->delete; |
21 |
Koha::AuthorisedValueCategories->delete; |
21 |
|
22 |
|
22 |
# insert |
23 |
# insert |
23 |
Koha::AuthorisedValueCategory->new({ category_name => 'av_for_testing' })->store; |
24 |
Koha::AuthorisedValueCategory->new({ category_name => 'av_for_testing', is_system => 1 })->store; |
24 |
Koha::AuthorisedValueCategory->new({ category_name => 'aaav_for_testing' })->store; |
25 |
Koha::AuthorisedValueCategory->new({ category_name => 'aaav_for_testing' })->store; |
25 |
Koha::AuthorisedValueCategory->new({ category_name => 'restricted_for_testing' })->store; |
26 |
Koha::AuthorisedValueCategory->new({ category_name => 'restricted_for_testing' })->store; |
26 |
my $av1 = Koha::AuthorisedValue->new( |
27 |
my $av1 = Koha::AuthorisedValue->new( |
Lines 84-89
ok( $av2->id(), 'AV 2 is inserted' );
Link Here
|
84 |
ok( $av3->id(), 'AV 3 is inserted' ); |
85 |
ok( $av3->id(), 'AV 3 is inserted' ); |
85 |
ok( $av4->id(), 'AV 4 is inserted' ); |
86 |
ok( $av4->id(), 'AV 4 is inserted' ); |
86 |
|
87 |
|
|
|
88 |
{ # delete is_system AV categories |
89 |
try { |
90 |
Koha::AuthorisedValueCategories->find('av_for_testing')->delete |
91 |
} |
92 |
catch { |
93 |
ok( |
94 |
$_->isa('Koha::Exceptions::CannotDeleteDefault'), |
95 |
'A system AV category cannot be deleted' |
96 |
); |
97 |
}; |
98 |
|
99 |
try { |
100 |
Koha::AuthorisedValueCategories->search->delete |
101 |
} |
102 |
catch { |
103 |
ok( |
104 |
$_->isa('Koha::Exceptions::CannotDeleteDefault'), |
105 |
'system AV categories cannot be deleted' |
106 |
); |
107 |
}; |
108 |
} |
109 |
|
87 |
is( $av3->opac_description, 'opac display value 3', 'Got correction opac description if lib_opac is set' ); |
110 |
is( $av3->opac_description, 'opac display value 3', 'Got correction opac description if lib_opac is set' ); |
88 |
$av3->lib_opac(''); |
111 |
$av3->lib_opac(''); |
89 |
is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' ); |
112 |
is( $av3->opac_description, 'display value 3', 'Got correction opac description if lib_opac is *not* set' ); |
90 |
- |
|
|