|
Lines 160-170
$schema->storage->txn_rollback;
Link Here
|
| 160 |
|
160 |
|
| 161 |
subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub { |
161 |
subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub { |
| 162 |
|
162 |
|
| 163 |
plan tests => 20; |
163 |
plan tests => 23; |
| 164 |
|
164 |
|
| 165 |
$schema->storage->txn_begin; |
165 |
$schema->storage->txn_begin; |
| 166 |
|
166 |
|
| 167 |
my $biblio = $builder->build_sample_biblio; |
167 |
my $biblio = $builder->build_sample_biblio; |
|
|
168 |
my $biblio2 = $builder->build_sample_biblio; |
| 168 |
|
169 |
|
| 169 |
# Have two known libraries for testing purposes |
170 |
# Have two known libraries for testing purposes |
| 170 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
171 |
my $library_1 = $builder->build_object({ class => 'Koha::Libraries' }); |
|
Lines 187-192
subtest 'buildKohaItemsNamespace() including/omitting items tests' => sub {
Link Here
|
| 187 |
like( $xml, qr{<homebranch>$library_1_name</homebranch>}, '$item_1 present in the XML' ); |
188 |
like( $xml, qr{<homebranch>$library_1_name</homebranch>}, '$item_1 present in the XML' ); |
| 188 |
like( $xml, qr{<homebranch>$library_2_name</homebranch>}, '$item_2 present in the XML' ); |
189 |
like( $xml, qr{<homebranch>$library_2_name</homebranch>}, '$item_2 present in the XML' ); |
| 189 |
unlike( $xml, qr{<homebranch>$library_3_name</homebranch>}, '$item_3 not present in the XML' ); |
190 |
unlike( $xml, qr{<homebranch>$library_3_name</homebranch>}, '$item_3 not present in the XML' ); |
|
|
191 |
|
| 192 |
t::lib::Mocks::mock_preference('OpacHiddenItems', 'biblionumber: ['.$biblio2->biblionumber.']'); |
| 193 |
my $hid_rs = $biblio->items->search({ "me.itemnumber" => { '!=' => $item_3->itemnumber } })->filter_by_visible_in_opac(); |
| 194 |
$xml = C4::XSLT::buildKohaItemsNamespace( $biblio->biblionumber, undef, $hid_rs ); |
| 195 |
like( $xml, qr{<homebranch>$library_1_name</homebranch>}, '$item_1 present in the XML' ); |
| 196 |
like( $xml, qr{<homebranch>$library_2_name</homebranch>}, '$item_2 present in the XML' ); |
| 197 |
unlike( $xml, qr{<homebranch>$library_3_name</homebranch>}, '$item_3 not present in the XML' ); |
| 198 |
|
| 190 |
## Test passing one item in hidden_items and items_rs |
199 |
## Test passing one item in hidden_items and items_rs |
| 191 |
$xml = C4::XSLT::buildKohaItemsNamespace( $biblio->biblionumber, [ $item_1->itemnumber ], $items_rs->reset ); |
200 |
$xml = C4::XSLT::buildKohaItemsNamespace( $biblio->biblionumber, [ $item_1->itemnumber ], $items_rs->reset ); |
| 192 |
|
201 |
|
| 193 |
- |
|
|