Lines 19-25
Link Here
|
19 |
|
19 |
|
20 |
use Modern::Perl; |
20 |
use Modern::Perl; |
21 |
|
21 |
|
22 |
use Test::More tests => 11; |
22 |
use Test::More tests => 10; |
23 |
|
23 |
|
24 |
use Koha::Library; |
24 |
use Koha::Library; |
25 |
use Koha::Libraries; |
25 |
use Koha::Libraries; |
Lines 88-95
is( Koha::Libraries->search->count, $nb_of_libraries + 1, 'Delete should have de
Link Here
|
88 |
$retrieved_category_2->delete; |
88 |
$retrieved_category_2->delete; |
89 |
is( Koha::LibraryCategories->search->count, $nb_of_categories + 2, 'Delete should have deleted the library category' ); |
89 |
is( Koha::LibraryCategories->search->count, $nb_of_categories + 2, 'Delete should have deleted the library category' ); |
90 |
|
90 |
|
91 |
t::lib::Mocks::mock_preference('MARCOrgCode', 'US-Default'); |
|
|
92 |
is( $new_library_1->get_effective_marcorgcode, 'US-MyLib', 'If defined, use library\'s own marc org code'); |
93 |
is( $new_library_2->get_effective_marcorgcode, 'US-Default', 'If not defined library\' marc org code, use the one from system preferences'); |
94 |
|
95 |
$schema->storage->txn_rollback; |
91 |
$schema->storage->txn_rollback; |
96 |
- |
92 |
|
|
|
93 |
subtest '->get_effective_marcorgcode' => sub { |
94 |
|
95 |
plan tests => 4; |
96 |
|
97 |
$schema->storage->txn_begin; |
98 |
|
99 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries', |
100 |
value => { marcorgcode => 'US-MyLib' } }); |
101 |
my $library_2 = $builder->build_object({ class => 'Koha::Libraries', |
102 |
value => { marcorgcode => undef } }); |
103 |
|
104 |
t::lib::Mocks::mock_preference('MARCOrgCode', 'US-Default'); |
105 |
|
106 |
is( $library_1->get_effective_marcorgcode, 'US-MyLib', |
107 |
'If defined, use library\'s own marc org code'); |
108 |
is( $library_2->get_effective_marcorgcode, 'US-Default', |
109 |
'If not defined library\' marc org code, use the one from system preferences'); |
110 |
|
111 |
t::lib::Mocks::mock_preference('MARCOrgCode', 'Blah'); |
112 |
is( $library_2->get_effective_marcorgcode, 'Blah', |
113 |
'Fallback is always MARCOrgCode syspref'); |
114 |
|
115 |
$library_2->marcorgcode('ThisIsACode')->store(); |
116 |
is( $library_2->get_effective_marcorgcode, 'ThisIsACode', |
117 |
'Pick library_2 code'); |
118 |
|
119 |
$schema->storage->txn_rollback; |
120 |
}; |